1 Reply Latest reply on Jun 29, 2007 3:07 AM by Clark_Kent101

    Display different panel

    Gruik
      Hello,

      I've got a website with a menu bar (left part) and a panel (right part).

      I want this :

      The panel display informations about the selected link of the menubar.

      e.g :

      When I click on Enterprise, the panel must display information about the enterprise.


      The menubar is already created with xml data. The event onclick is created too.
      But i don't know how to do a link to a MXML file containing a panel!

      The event function :


      private function menuHandler(event:MenuEvent):void {


      CanvasSecondaire.removeAllChildren();

      if (event.item.@data == "linkselected")
      {
      // LINK TO A MXML FILE CONTAINING A PANEL <---- I NEED TO KNOW HOW DO THAT
      CanvasSecondaire.addChild(NAMEOFTHEPANEL);
      }

      }

      Can you help me ?

      Thank you !
        • 1. Re: Display different panel
          Clark_Kent101 Level 1
          Just before adding the panel, you could create an instance of the panel to be added, and use the object instance to access the public properties of the mxml component you want to add. Once you've got the data passed into that mxml component you can bind it to whatever control you want to display the data.

          For example:

          ------------------------------------------------------------

          if (event.item.@data == "linkselected")
          {

          var objectInstace:mxml_component_name = new mxml_component_name();

          objectInstance._publicData = enterpriseData;

          CanvasSecondaire.addChild(NAMEOFTHEPANEL);
          }

          ------------------------------------------------------------

          The _publicData is the public bindable variable in the panel mxml component, and enterpriseData is the data you want shown in the mxml component.

          Hope this helps,

          - Tony