Use the change event of the ViewStack and then test the event.newValue for a page number.

The sample below toggles between two panels incrementing a label each time.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

  <mx:ViewStack id="myStack"  change="incrementCount(event)" >

    <mx:Panel label="first" >

      <mx:Label text="Label1" mouseUp="myStack.selectedIndex=1;myStack.invalidate"/>

    </mx:Panel>

    <mx:Panel label="second" >

      <mx:Label id="lblCount" text="0"  mouseUp="myStack.selectedIndex=0;myStack.invalidate"/>

    </mx:Panel>

  </mx:ViewStack>

  <mx:Script>

<![CDATA[

  function incrementCount(event) {

    if (event.newValue==1)

      lblCount.text = 1 + Number(lblCount.text);

  }

]]>

</mx:Script>

</mx:Application>


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 02, 2005 12:31 AM
To: [EMAIL PROTECTED]
Subject: [flexcoders] ViewStack container

 

Hi ,

I have 3 diff. pages in a ViewStack container.
I want to reset some values when one of the
page in the viewstack is displayed everytime.

Byusing which event or any method or way should I achieve this?

--
Regards,

Ketan Bengali
Multimedia Programmer


Reply via email to