Skip to main content
Known Participant
April 7, 2018
Answered

text box duplications

  • April 7, 2018
  • 23 replies
  • 3642 views

hi i want to have two text inputs and a submit button, and when i press the submit button after entering a number or text or both in the text input field that the other text input field replicates the text box and that the original resets to empty and the data entered is representative in the text field that replicated the text field used when entering information before pressing the submit button.

button is called by instance button, the text input field instance is called enter, and the resultant text field instance is called result1,

secondly i would like the text input field instance called result 1 to be duplicated for every time a number is or character is selected and submitted, and a new text input box to be put underneath text input instance result 1 duplicate called text input instance result 1a, perfectly and to change the information represented in text input instance called result1 but not in instance called result 1a, and those that are perfectly aligned underneath it called instance name : result 1b, result 1c, result 1 d, result 1e, and to follow the pattern nameing them, perhaps not a,b,c,d,e but rather 1,2,3,4,5... and so on.

please can someone help me with a code in AS 2.0, im using adobe 5.5

This topic has been closed for replies.
Correct answer kglad

1.

button.onRelease=function(){

result1.text=enter.text;

enter.text="";

}

2.  i don't understand what all you're trying to do, but you can use the movieclip method createTextField() to create a new textfield using as2.

23 replies

Known Participant
April 9, 2018

Known Participant
April 9, 2018

okay, the two examples ive got work and align to the "enter" and "enter1" which i added in, ill show you a photo but they dont show one under the other unfortunately like yours did in the pic you showed.

Known Participant
April 9, 2018

yes i dont have a enter text box,

Known Participant
April 9, 2018

i just made a "enter" movie clip and the text input field re aligns to the top inline with it, but doesnt align the answers in a column effect,

Known Participant
April 9, 2018

Known Participant
April 9, 2018

I would like it if the mark button can see if the answers entered are the same as the answers entered by the student and if so so takes a library image of a right tick and puts it next to the question number and if incorrect next to the wrong answer, so can we do this set by step please, my text input on go1 i would like to move horizontally or vertically on the screen how do i do that, and its not putting the answers underneath one another how do i do that, where did i go wrong?

Known Participant
April 9, 2018

I would like to add a reference to the aligned inputs that are gathered by entering the text or number to reflect in another such text input field, that can be changed if the student so wishes to

Known Participant
April 9, 2018

i want to create boonlean movie clips that hold text around the input box, with a question, and in the future i would want to limit th answers to be text or numeric or both, how would i do that?

Known Participant
April 9, 2018

then i had the idea to do the same in the second "size3" and "size4" with the go 3 and go4 and to have the correct answers in another vertical column.

Known Participant
April 9, 2018

yes, and if those are the answers entered in "size" and then press go, and then am asked are you sure? then go1 is pressed

Known Participant
April 9, 2018

Yes but my answers are not running downwards vertically,

kglad
Community Expert
Community Expert
April 9, 2018

your setup isn't ideal.  i recommend:

1. you should create an array of your questions.

2. if you're going to score the answers in this app you should also create an array of answers.

3. you should then create an initial keyframe with the quiz instructions.

4. a 2nd keyframe for the quiz

5. a 3rd keyframe for the score/results if those are doing to be presented to the student.

the 2nd keyframe:

would include coding to present the questions typically with a combobox or stepper.

there would be one button to save the students answers (in your vertically aligned textfields) (with additional info so they can easily see their answer number)

there would be one textfield for the student's answers to all questions.

Known Participant
April 9, 2018

mine doesnt align underneath each other yet and is still one behind the other

Known Participant
April 9, 2018

your example is right :

i used this code :

go._visible = true;

go.onRelease = function(){

size.text = size1.text;

size1.text="";

}

go1.onRelease = function() {

var d:Number = this._parent.getNextHighestDepth();

this._parent.createTextField("tf_"+d,d,enter._x,enter._y + next_tfY + 40,150,40);

this._parent['tf_' + d].textColor=0xff0000;  //red

this._parent['tf_' + d].borderColor = 0x00ff00;  //green

this._parent['tf_' + d].text = size.text;

this._parent['tf_' + d].border = true;

size.text = '';

next_tfY += 40;

};

Known Participant
April 9, 2018

i went a bit further and did another text input size 3 and another size 4 and did two more go buttons go3 and go4, and in the same format did this :

go3._visible = true;

go3.onRelease = function(){

size3.text = size4.text;

size4.text="";

}

go4.onRelease = function() {

var d:Number = this._parent.getNextHighestDepth();

this._parent.createTextField("tf_"+d,d,enter._x,enter._y + next_tfY + 40,150,40);

this._parent['tf_' + d].textColor=0xff0000;  //red

this._parent['tf_' + d].borderColor = 0x00ff00;  //green

this._parent['tf_' + d].text = size4.text;

this._parent['tf_' + d].border = true;

size4.text = '';

next_tfY += 40;

};

and this second one doesnt display in size 4 nor does it create a box in the left corner when i press go4.