Skip to main content
Known Participant
April 7, 2018
Answered

text box duplications

  • April 7, 2018
  • 23 replies
  • 3612 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 13, 2018

hi kglad, an you help me with something please.

i took the code for textbox duplications, eg, a.text = b.text; b.text =b.text; "b " being where i enter the text;

in the same movie clip it works well, i tried seperating them into different movie clips but didnt work.

is it possible to have them in different movie clips ?

Known Participant
April 10, 2018

i took a chance after posting here : i used this code :

go._visible = true;

go.onRelease = function(){

size.text = size1.text;

size1.text = size1.text;

sizea.text = size1a.text;

size1a.text = size1a.text;

sizeb.text = size1b.text;

size1b.text = size1b.text;

sizec.text = size1c.text;

size1c.text = size1c.text;

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 = size1.text;

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

size1.text = size1.text;

next_tfY += 40;

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 = size1a.text;

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

size1a.text = size1a.text;

next_tfY += 40;

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 = size1b.text;

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

size1b.text = size1b.text;

next_tfY += 40;

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 = size1c.text;

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

size1c.text = size1c.text;

next_tfY += 40;

};

thing is im still sitting now with the trouble that the text field created is one on top of the other,

kglad
Community Expert
Community Expert
April 10, 2018

next_tfY needs to be initialized.

Known Participant
April 10, 2018

how do i do that ?

Known Participant
April 10, 2018

i got this code on a combined code but only for one text input :

go._visible = true;

go.onRelease = function(){

size.text = size1.text;

size1.text = size1.text;

sizea.text = size1a.text;

size1a.text = size1a.text;

sizeb.text = size1b.text;

size1b.text = size1b.text;

sizec.text = size1c.text;

size1c.text = size1c.text;

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 = size1.text;

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

size1.text = size1.text;

next_tfY += 40;

};

and the picture looks like this :

Known Participant
April 10, 2018

HI, here a image of a new data entry im trying to create.

Ive got teacher mathamatical questions, lined up under one another that have one button the teacher uses to send the teachers questions to a text input where it displays perfectly.

next to where the teachers questions display is a text input field for answers to be entered by the student,

in this quiz there are 4 question displayed together and 4 answers displayed together and when the answeres are filled in the submit button is pressed,

for the teachers part there is another button that is to save all four questions together to a new text field, that in this example is visible because of the border being on, ive an example of it for one text input that was shown to me yesterday and the day before, i would like to know how to code the button to send all four texts inputs in a batch arranged in order as displayed decending.

the teacher inputs are named in decending order : size1, size1a, size1b, size1c, the existing code used on the button called : go is :

go._visible = true;

go.onRelease = function(){

size.text = size1.text;

size1.text = size1.text;

sizea.text = size1a.text;

size1a.text = size1a.text;

sizeb.text = size1b.text;

size1b.text = size1b.text;

sizec.text = size1c.text;

size1c.text = size1c.text;

}

the other button that is there has a code for just one item and looks like this :

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 = size1.text;

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

size1.text = size1.text;

next_tfY += 40;

};

can this code include function to do the same for text input fields :size1a, size1b, size1c, on the go1 button

and if i want to combine all the code onto button : go

what would the code then look like, as im worried if i combine it all that it doesnt function.

my concern is to complete the teachers part first, before attempting the students answers part

Known Participant
April 9, 2018

The way im feeling about this, is like i like things to work well, and to know why things work and what they represent where and thats why things work , and the code you help me with was a bit difficult, i understood the colour, the border colour, the text box = text box thats was cool, but the parent. createTextfield() part  and the bits there after i dont understand what what means in the line of code.

Known Participant
April 9, 2018

I've been online since 10 am its now 12;30 pm, ive been in and out during the day and am quite tired now and feel i havent achieved, and asked for support to get the attension as spoken about in the email but havent had a response about it, the example you help me with that you send me a picture of how yours looks, that mine was suppose to look like, has those field got names that can be used ? without using the array version.

Known Participant
April 9, 2018

cool, ive never heard of a stepper before ive heard of a radio button, or drop down box, ive recently taken to this cool program and dont try any other program other than fireworks but its rare, and i enjoy drawing in adobe flash and thought of using booleans and buttons to go through boonleans, such as

button1._onRelease = function(){

1._visible = false;

2._visible = true,

button2._visible = true;

}

and to have the text input field for written things, im interested to know more about how to radio buttons that may have an answer such true or false that can be written in to a text field.

kglad
Community Expert
Community Expert
April 9, 2018

check the as2 api for info on flash components including the stepper, combobox and radio buttons.

btw, all the stuff i've been responding to in this forum are much simpler (and less expensive) than your email about social media login, database creation and data storage in that database.

Known Participant
April 9, 2018

in this code i dont see var d : Number = 0; any more; itried moving "number" a space away from th " :" and the number sent to the block keeps changing and theres no record of any previous ones, so i reverted back.

kglad
Community Expert
Community Expert
April 9, 2018

your setup is too messy (for me) to debug via a forum.  i recommend you rethink your setup and consider using the info in message 48.

Known Participant
April 9, 2018

okay, the above is useful if i want to add text to a page and update it at a later time via a login page on the site for myself from anywhere.and has helped me alot thank you ill start a new discussion again with furthering the things i need thank you.

Known Participant
April 9, 2018

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;

};

go4.onRelease = function() {

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

this._parent.createTextField("tf_"+d,d,enter1._x,enter1._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 another thing when i press go 4 and go1 can the text fields keep the text and not become blank, if so please add that in for me. on text fields size (used with button go1) and size 4( used with buttongo4)

Known Participant
April 9, 2018

i was trying something, because i saw the number kept dissapearing when i pressed go1 or go4, so on go 1 i added

:

size.text = size.text;

next_tfY += 40;

};

at the end

instead of

size.text = '';

next_tfY += 40;

};

and atleast it keeps its the text it gets before i press go1, so thats sorted.

Known Participant
April 9, 2018

Known Participant
April 9, 2018

before i create a new project doing it with arrays, how can i find the text inputs if they do not have a border on how can i see the individual names of the text inputs saved ? and can you check my codes on go4 and go1 to see if they need changing so they dont go one behind the other but fall under one another as did please.