2 Replies Latest reply on Aug 23, 2006 1:48 PM by jmortimer

    Navigation within a function

    jmortimer Level 1
      I am trying to get an accordian to change what Pane it is in when an action occurs. In the below code, I want to click the button to go to the indicated pane. I have tried mutliple things, with no luck. Does anyone know what script to place within the function to do this?

      Thanks for the help. Code below:
      -----------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      private function toPane2():void
      {

      }
      private function toPane1():void
      {

      }
      ]]>
      </mx:Script>
      <mx:Accordion x="10" y="10" width="200" height="200">
      <mx:Canvas label="Accordion Pane 1" width="100%" height="100%">
      <mx:Button x="10" y="10" label="Move to Pane 2" id="ToPane2" click="toPane2();"/>
      </mx:Canvas>
      <mx:Canvas label="Accordian Pane 2" width="100%" height="100%" id="ToPane1">
      <mx:Button x="10" y="10" label="Move to Pane 1" click="toPane1();"/>
      </mx:Canvas>
      </mx:Accordion>
      </mx:Application>
        • 1. Re: Navigation within a function
          peterent Level 2
          It will help to give your Accordion an id so you can refer to it within the functions:

          <mx:Accordion id="myAcc" x="10" y="10" width="200" height="200">

          The children of the Accordion are indexed 0, 1, etc. so:

          private function toPane2():void
          {
          myAcc.selectedIndex = 1;
          }
          private function toPane1():void
          {
          myAcc.selectedIndex = 0;
          }
          • 2. Re: Navigation within a function
            jmortimer Level 1
            First of all, peterent is the man with the plan. That works great...and seams so obvious now that I see it. Thanks.

            But anyways. How would I do this from one component to another? Meaning, press a button over here in this component to affect an accordian over there in that component.

            Thanks for any ideas.