ljonny18
11-06-2006, 09:21 AM
Hi - can someone help.....
I have a simple query, but am not sure of the best way to go about doing it. I have read up on the events and given them a go, but have had no joy.
Basically, for example, I have a main mxml file "main.mxml" containing a view stack linking to an additional 2 mxml components:
<mx:ApplicationControlBar id="appBar_apc">
<mx:LinkBar dataProvider="viewStack_vs"/>
</mx:ApplicationControlBar>
<mx:ViewStack id="viewStack_vs">
<mi:page1 id="page_1" label="this is page 1"/>
<mi:page2 id="page_2" label="this is page 2"/>
</mx:ViewStack>
I want to have a button in page1.mxml which when is clicked runs a function that is in page2.mxml!
I guess an event can be dispatched that is listened for in page2.mxml and runs the function when it is dispatched etc.... although I can’t work out how to do this :(
page1.mxml:
<mx:button label=”click me” click=”run the testFunction in page2.mxml”/>
page2.mxml
public function testFunction()
{
Alert.show(“hello”);
}
Etc…..
Can anyone help? or post an example for me?
Thanks,
Jon.
I have a simple query, but am not sure of the best way to go about doing it. I have read up on the events and given them a go, but have had no joy.
Basically, for example, I have a main mxml file "main.mxml" containing a view stack linking to an additional 2 mxml components:
<mx:ApplicationControlBar id="appBar_apc">
<mx:LinkBar dataProvider="viewStack_vs"/>
</mx:ApplicationControlBar>
<mx:ViewStack id="viewStack_vs">
<mi:page1 id="page_1" label="this is page 1"/>
<mi:page2 id="page_2" label="this is page 2"/>
</mx:ViewStack>
I want to have a button in page1.mxml which when is clicked runs a function that is in page2.mxml!
I guess an event can be dispatched that is listened for in page2.mxml and runs the function when it is dispatched etc.... although I can’t work out how to do this :(
page1.mxml:
<mx:button label=”click me” click=”run the testFunction in page2.mxml”/>
page2.mxml
public function testFunction()
{
Alert.show(“hello”);
}
Etc…..
Can anyone help? or post an example for me?
Thanks,
Jon.