Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

text box duplications

Explorer ,
Apr 07, 2018 Apr 07, 2018

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

TOPICS
ActionScript
3.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 07, 2018 Apr 07, 2018

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.

Translate
Explorer ,
Apr 07, 2018 Apr 07, 2018

can any one comment or reply please

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 07, 2018 Apr 07, 2018

I tried the above code given by yourself, thank you it works perfectly, the movie clip method create text field() ?

can you give me a coding for the above please.

Ie. button.onRelease = function(){

....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 07, 2018 Apr 07, 2018

yes there is a text input that is set to the text entered when the button is presses, i would like to add a third text input field that also gets the input and does not change when another figure is entered, but instead creates the forth text field input field and stores it as the "second" text input that recieves the entered data and places that box underneath the previous stored figure., and so im hoping to another text field input box created as a second text input box that recieves infomation entered and stored it and is the third stored text input box in a vertical row.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2018 Apr 07, 2018

var next_tfY:Number=0;

button.onRelease=function(){

var d:Number=this.getNextHighestDepth();

this.createTextField("tf_",d,enter.x,enter.y+next_tfY+40,150,40);

this['tf_'+d].text = enter.text;

enter.text='';

next_tfY+=40

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

HI the code i changed to suit a new button called go1, and used the textinput field size1 which is the resultant text input field from the input text field called size, which is where the text is entered, so i entered text pressed the go button and the text appears in the text input called size 1, heres the code.

go._visible = true;

go.onRelease = function(){

size.text = size1.text;

size1.text="";

}

then i added a resize to a movie clip on the same go button and it works perfect heres the code

go.onPress = function(){

ball1._width = Number(size.text);

ball1._height = Number(size.text);

}

I added the code you gave me and i dont see the new textinput field anywhere on the screen, i used this code

var next_tfY:Number=0;

go1.onRelease=function(){

var d:Number=this.getNextHighestDepth();

this.createTextField("tf_",d,enter.x,enter.y+next_tfY+40,150,40);

this['tf_'+d].text = size1.text;

size1.text='';

next_tfY+=40

}

after pressing go to update the field, i press go1 to store it but the text input field is not where to be see on the screen.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

y text fielt input "size" is  w:158 h:26 x:585.95 y:341.05

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

my canvass size 1646 x 980

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2018 Apr 08, 2018

use:

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

size1.text = '';

next_tfY += 40;

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

hi, is this code AS 2.0 ? because i used it as this :

go1._visible = true;

go1._onRelease = function(){

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

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

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

size1.text = '';

next_tfY += 40;

};

the instance names are different the resultant text field is called size , and the instance of the text field used to enter is size1

and the button is go1.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

i tried this too :

go1._visible = true;

var next_tfY:Number = 0;

go1.onRelease = function(){

var d:Number = this.getNextHighestDepth();

this.createTextField("tf_",d,size1.x,size1.y+next_tfY+40,150,40);

this['tf_'+d].text = size1.text;

size.text='';

next_tfY+=40

}

with no success

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

go1._visible = true;

go1._onRelease = function(){

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

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

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

size.text = '';

next_tfY += 40;

};

also seems not to work

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

go1._visible = true;

var next_tfY:Number = 0;

go1.onRelease = function(){

var d:Number = this.getNextHighestDepth();

this.createTextField("tf_",d,size.x,size.y+next_tfY+40,150,40);

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

size.text='';

next_tfY+=40

}

when i press go1, the "size" text field becomes empty

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

when i tried changing the button to the go button then no text appers as it was previously doing before i pressed go1,

i tried this:

go._visible = true;

go.onRelease = function(){

size.text = size1.text;

size1.text="";

var d:Number = this.getNextHighestDepth();

this.createTextField("tf_",d,size.x,size.y+next_tfY+40,150,40);

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

size.text='';

next_tfY+=40

}

go.onPress = function(){

ball1._width = Number(size.text);

ball1._height = Number(size.text);

}

and the object movie clip ball doesnt resize either, so i would prefer to get it duplicating and appearing on the screen instead of making the text box go blank and will go back to using the go1 button, which needs a code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

grab.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

grab2.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2018 Apr 08, 2018

this code:

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

size1.text = '';

next_tfY += 40;

};

works with a button go1, and a textfield named size1.  if size1 has no text, you won't see the added textfield.  if you want to see an empty textfield enable its border property:

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

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

size1.text = '';

next_tfY += 40;

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

The border is black, and is in the top left corner, of the page when i press go1, thank you.

thank you im glad i can see the border of the text box, when i tried entering another input the same input box and press go the box updates to the text input however when i press go1 the previous input remains in the text input ield in the top left corner, is the new one by any change right behind it and cannot be seen? is it possible to have it undeneath please, so that it continues putting the text boxes in a vertical row please.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

In another discussion you mentioned i can keep record of each new text "storing" in an array, and gave me this code :

you could store them in an array:

var tfA:Array = [];

.

.

this._parent.createTextField("tf_"+d,...);

tfA.push(this._parent['tf_'+d]);

can i add this to go1 ?,and how will will it display ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

if i do the same coding on a different text input that gives the same result is it possible to align it next to the working example you've given to, which im very thankful for thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2018 Apr 08, 2018

yes, you can align textfields.  how you need to do that depends on what textfields you're trying to align, but generally you use the _x and _y properties of the two (or more) textfields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 08, 2018 Apr 08, 2018

okay ,

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

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

size.text = '';

next_tfY += 40;

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

};

i dont know what wrong now, but the text box in top left corner doesnt appear any more.

and the textfield reference that are now going to be stored, where will i find them? or where can i have them display to ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2018 Apr 08, 2018

don't use both.  just use one createTextField:

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

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

size.text = '';

next_tfY += 40;

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 09, 2018 Apr 09, 2018

okay, thank you, to the text input box that appears in the top left corner, as you changed the border to be on, can you show me how to

change the colour of the border and the colour of the font and the font itself too please.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines