Mark
Mark

Reputation: 632

AS3 Dynamic TextField not updating

This is nuts

I have a dynamic textfield on my stage with the instance name trackText.

I have declared public var trackText:TextField;.

When I trace trackText.text it gives me exactly what I expect but the actual text on the stage does not update.

anyone have any ideas as to why?

public var trackText:TextField;

trackText.text = audioPlayer.currentSong.title;

trace("trackText = " + trackText.text);

// gives me what i expect "track 1" etc..

but the text on the stage still says "loading..."

any help would be great ta

Upvotes: 1

Views: 3993

Answers (3)

Benny
Benny

Reputation: 2228

I think that you haven't assigned correctly to the textField.

Try increasing the width of the textField, and set its maxChars property.

Upvotes: 0

Gal Margalit
Gal Margalit

Reputation: 5854

Embed the chars you are using: properties panel -> embed

Upvotes: 2

KennyRules
KennyRules

Reputation: 221

If you have one on the stage, then creating a new one with

public var trackText:TextField;

doesn't link it to the one on the stage but still allows it to have its own text as your trace statement shows. You would first need to say something like:

trackText = textFieldOnStageInstanceName;

In order to hook them up. Then you can change the text as you have done!

Note: You don't even need to declare a variable and instead just reference the instance name in the code through something like:

theDoc.textFieldOnStageInstanceName.text = "Yay!";

Hope this helped!!

Upvotes: 3

Related Questions