Groups | Blog | Home
all groups > flash actionscript > january 2006 >

flash actionscript : insert an enter a dynamic field through action script


bso_71
1/26/2006 10:44:57 PM
How do I insert an ENTER in a dynamic field through action script??? I want to have two lines of text and I want to insert them through a variable.

Thanks!

zensoldier
1/26/2006 11:02:27 PM
I would create a movie clip that is the text field you want. (embedded fonts,
text size, etc), call the textbox on the movie clip 'textLabel'

set the linkage for that clip so you can use attachMovie to clone it to the
stage.

_root.attachMovie("yourLinkageName", "yourTextBox", getNextHighestLayer());

Then set the _x and _y of the text box

_root.yourTextBox._y = 39;
_root.yourTextBox._x= 50;

Then set your text

_root.yourTextBox.textLabel.text = yourVariable;

Give that a try

bso_71
1/27/2006 1:48:06 AM
Ok. This I have it clear. But I want to put two different texts in one dynamic
field and each text (text1) in one line and text2 in line 2. Can I put

_root.myText_txt.text = myVariable1+RETURN+myVariable2
or
_root.myText_txt.text = myVariable1+ENTER+myVariable2

or something like that?

Thanks!

NSurveyor
1/27/2006 2:00:33 AM
You can use:

_root.myText_txt.text = myVariable1+'\n'+myVariable2;
or
_root.myText_txt.text = myVariable1+'\r'+myVariable2;
or
_root.myText_txt.text = myVariable1+newline+myVariable2;

For the first two ways, if you are using actual strings, you can include the
\n right in the string... e.g.:

_root.myText_txt.text = "this is some text\nwith another line!";
or
_root.myText_txt.text = "this is some text\rwith another line!";

AddThis Social Bookmark Button