9 Replies Latest reply on Apr 23, 2009 1:28 PM by ghoul11

    how do I pass an actionscript variable to an event function call in mxml?

      This has to be simple, but I'm really struggling finding an answer for this.

      A simple example: let's say I have an actionscript variable definition

       

      private var theString:String = "test";

       

      Then I have a function:

       

      private function showString(myString:String){

           Alert.show(myString);

      }

       

      Then I have some mxml:

      For the life of me, I can't get the click event to fire correctly...Here are the 2 variations I've tried that seem intuitive to me but neither works.

       

      <mx:Button click="showString(theString)" />

      or

      <mx:Button click="showString({theString})" />

       

      ANy input would be appreciated.

       

      Thanks