Call a Method From Within an MXML that is in a Viewstack

Website / Blog : www.how-to-code.com

Contact : This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Say you have a Viewstack. You have many MXML classes in that viewstack.
When you hit one of those MXML items you wish to call a method in that MXML item, everytime the MXML item is hit. You also want to call the method from within the MXML itself.

You could try using show in Flex, example below;

ie. Here is one of the MXML classes in the Viewstack. This calls initCongratulationsScreen() method when the MXML class in the viewstack is clicked.

 

1
2
3
4
5
6
7
8
 xmlns:mx="http://www.adobe.com/2006/mxml" 
width="100%"
height="100%"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
horizontalAlign="center"
verticalAlign="middle"
show="initCongratulationsScreen()">