ForumsProgramming ForumText in Flash

2 5990
Reegan777
offline
Reegan777
4 posts
Nomad

Hi, I'm having trouble with text at the moment. What I'd like to do is enter a text box into a movieclip symbol so that I can have the text perform various animations (move, fade out by lowering alpha value, etc.) however I want the contents of the text box to be based on a variable and able to be changed multiple times during runtime. How do I accomplish this? I can enter a text box into a symbol and manipulate static text easily enough, but I mainly don't know how to change the contents with code during runtime.

  • 2 Replies
strouthas
offline
strouthas
24 posts
Nomad

Make it dynamic from properties. Have in mind that you must embed the fonts used in that textfield though.

weirdlike
offline
weirdlike
1,299 posts
Prince

//var properties or whatever var you want
var txtNum:Number = 1;
//leave blank at first
var text = "";

// add listener "variable_txt" is a dynamic text box
variable_txt.addEventListener (Event.ENTER_FRAME, varShow);
function varShow (event:Event)
{
variable_txt.text = String ("TEXT:"+txtNum+text);
}

you can change the number value or text value to whatever you want and the listener will update to show
example

Showing 1-2 of 2