So let’s say I have the following code:
public function first(text:String):String {
_text = text;
dispatchEvent(event);
//Want this statement to return the value of _text
//after handler has finished transforming text.
return _text;
}
//handles the event
public function handler(event:Event):void {
//does things, then changes the value of _text
_text = "next text that first needs to return";
}
How would I make sure the method (first) returns the correct value of _text after it has been transformed by (handler)?
Thank you in advance!
Since ActionScript is single-threaded language and event handlers don’t return value I assume that your code will work if _text is variable in package scope. Next code doesn’t make a big sense, but if you call
firstfunction from another class it can be useful