1 Reply Latest reply on Sep 28, 2006 10:29 AM by mac_martine

    change viewStack / mxml component on a mx:button click

    ljonny18
      Hi

      I am using the Flex 2 <mx:ApplicationControlBar> object and using it as the main separation and navigation etc of the “pages” / “components” within my application.

      I have set my <mx:ApplicationControlBar> in my main application mxml file, and have separated the various pages within an <mx:viewStack> accordingly also making use of the Application “xmlns” feature make the application more organised and structured…. e.g:


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:mi="components.*">

      <!-- set up application control bar -->
      <mx:ApplicationControlBar dock="true">
      <mx:LinkBar dataProvider="linkBar"/>
      </mx:ApplicationControlBar>

      <!-- populate application control bar within the ViewStack -->
      <mx:ViewStack id=" linkBar _lb">
      <mi:homePage id="page1" label="Page 1"/>
      <mi:homePage id="page2" label="Page 2"/>
      <mi:homePage id="page3" label="Page 3"/>
      <mi:homePage id="page4" label="Page 4"/>
      </mx:ViewStack>

      </mx:Application>


      this works fine, and when a <mx:viewStack> is clicked the relevant page / component is displayed – if “page1” is selected “Page 1” is shown in the browser etc….

      in a few of my pages / components I want to be able to change the current <mx:viewStack> when a <mx:button> is clicked…….

      Is this possible???

      For example if I am currently viewing “Page 2” and when I press an <mx:button> within this page I want to be “navigated” to “Page 3” – (without having to use the <mx:viewStack> ) :

      <mx:button click=”go to / show page 3”/>


      any suggestions???

      Thanks
      Jon.