Search code examples
actionscript-3airflex4mxmlstates

Changing state specific mxml parts in AS3


I'm using something like this in my MXML file:

<s:label id='mxml_label' text.state1='test' text.state2='test 2' />

Now i would like to change the state1 text from as3 on runtime.

Anyone any suggestions?

thx.


Solution

  • You could bind the text for state1 to a bindable string variable that you will then update whenever you want.

    [Bindable] private var state1TextString:String = "test";
    

    Then your expression becomes :

    text.state1="{state1TextString}"