zuke
11-07-2009, 03:44 AM
I have a button to change the current state. This button is in a external file as a MXML component. And that's probably why when the button is clicked, the current state doesn't change. How do I refer to the parent window from an component? pls help!
----main page----
<mx:states>
<mx:State name="state1">
<mx:AddChild position="lastChild">....
</mx:AddChild>
</mx:State>
</mx:states>
<local:menu1 id="external_mxml_component"/>
----menu1.mxml---
<mx:Canvas xmlns:mx......
<mx:Button click="currentState='state1';"/>
....
Because the button is reffering to the parent, I simply thought it would be
"parent.currentstate='state1';" but there was no such syntax. How do i do this??
----main page----
<mx:states>
<mx:State name="state1">
<mx:AddChild position="lastChild">....
</mx:AddChild>
</mx:State>
</mx:states>
<local:menu1 id="external_mxml_component"/>
----menu1.mxml---
<mx:Canvas xmlns:mx......
<mx:Button click="currentState='state1';"/>
....
Because the button is reffering to the parent, I simply thought it would be
"parent.currentstate='state1';" but there was no such syntax. How do i do this??