1 Reply Latest reply on Nov 24, 2011 9:34 PM by Flex harUI

    Using a var declared in a function outside that function

    __gravija__

      Hey, i am trying to do something i thought wouldn't be difficult, but looks like i'm wrong.

      So this is a function that runs from the start (creationcomplete). Inside i declare a var txt (which is a string)

       

       

       

      public function sendString(Event:FlexEvent):void

      {

      txt = "Voorbeeld van een band";

      }

       

       

      I want to call that var outside of the function. So I make it bindable. it's also the reason why i call teh var just by "txt" in the functions above.

       

       

      [Bindable]

      public var resultName:String;

       

       

      Now, in this label i call the var txt. However, the label stays empty. Though I don't get any errors.

       

       

       

      <s:Label x="20" y="69" fontSize="16" text="{txt}"/>

       

       

      Can anyone help me fix this? I figure it should be rather easy, but still.

      Also, If i call the function from a mouseclick, will i get an error then since the label asks for a var that doesn't exist yet?

       

      Many thanks!