2 Replies Latest reply on Mar 16, 2007 8:01 AM by arosequist

    Viewstack question

      I've been looking all day and can't find a solution to this - although I'm sure it's very simple.

      I have a main application that I'm using a ViewStack in:

      <mx:ViewStack id="preTrafficNav" width="100%" height="100%" creationPolicy="all" x="10" y="90">
      <v:JobSearch id="jobsearch" width="100%" height="100%"/> <v:Timeline3 id="timeline3" width="98%" height="711"/>

      This works great. :-)

      The JobSearch.mxml page has a button that when you click on it, I want to take the job_id variable I've declared and pass it to the Timeline3 page and have that page as the main page.

      If I put the button on the main.mxml page, everything works fine (except for passing the variable, but it will at least change the page)... but if I put the button on the JobSearch.mxml page it doesn't work. I guess I don't know the syntax for doing that.

      If someone would help me with the syntax to link from one child to another, when the children are their own mxml pages I would be soooo appreciative.


        • 1. Re: Viewstack question
          babo_ya Level 3
          I would dispatch an event from the JobSearch.mxml when the button is clicked and create a handler for that event to send the info to the Timeline.mxml.

          <v:JobSearch id="jobsearch" width="100%" height="100%" aEvent="eventHandler();/>

          and create an event handler
          public function eventHandler(event):void
          timeline3.aVariable = jobsearch.aVariable;

          Or you could alos create a custom event to pass the data using the event.

          hope this helps
          • 2. Re: Viewstack question
            arosequist Level 1
            To get my button to link correctly I did this (thanks to Gordon):

            <mx:Button label="Select"
            click="parentDocument.preTrafficNav.selectedIndex = 1"
            right="348" bottom="10" height="34"/>