2 Replies Latest reply on Feb 14, 2008 6:47 AM by Gregory Lafrance

    how connect to another application by using linkbar

    pmsk537
      In my program i have a linkbar, in that i decleared two string ,what i want actually is i click any one string in that linbar, it goes it corresponding page
        • 1. Re: how connect to another application by using linkbar
          Gregory Lafrance Level 6
          I would use a ViewStack:

          ------------------------------ ViewStack.mxml -------------------------------
          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:comp="components.*">
          <mx:Script>
          <![CDATA[
          private function selectPortal(event:Event):void {
          if(cmbx.selectedItem.data == "home"){
          portals.selectedChild = home;
          }
          if(cmbx.selectedItem.data == "hr_portal"){
          portals.selectedChild = hr_portal;
          }
          if(cmbx.selectedItem.data == "is_portal"){
          portals.selectedChild = is_portal;
          }
          if(cmbx.selectedItem.data == "pay_portal"){
          portals.selectedChild = pay_portal;
          }
          }
          ]]>
          </mx:Script>

          <mx:ApplicationControlBar width="100%">
          <mx:Label text="Select an intranet portal: " fontSize="12"/>
          <mx:ComboBox id="cmbx" change="selectPortal(event)">
          <mx:Object label="XYZ Intranet Home Page" data="home"/>
          <mx:Object label="Human Resources Portal" data="hr_portal"/>
          <mx:Object label="Information Services Portal" data="is_portal"/>
          <mx:Object label="Payroll Portal" data="pay_portal"/>
          </mx:ComboBox>
          </mx:ApplicationControlBar>
          <mx:ViewStack id="portals" width="100%" height="100%">
          <mx:Panel width="100%" height="100%" horizontalAlign="center"
          backgroundColor="#ccffcc" id="home">
          <mx:Text text="Welcome to the XYZ Corporate Intanet" fontSize="20"
          color="blue"/>
          </mx:Panel>
          <comp:HumanResources id="hr_portal"/>
          <comp:InformationServices id="is_portal"/>
          <comp:Payroll id="pay_portal"/>
          </mx:ViewStack>
          </mx:Application>
          ------------------------------------------------------------------------------------
          ---------- components/HumanResources.mxml ------------------
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Panel xmlns="*" xmlns:mx=" http://www.adobe.com/2006/mxml"
          width="100%" height="100%" horizontalAlign="center" backgroundColor="red">
          <mx:Text text="Human Resources Portal" fontSize="20"
          color="blue"/>
          </mx:Panel>
          ------------------------------------------------------------------------------------
          ---------- components/InformationServices.mxml ------------------
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Panel xmlns="*" xmlns:mx=" http://www.adobe.com/2006/mxml"
          width="100%" height="100%" horizontalAlign="center" backgroundColor="purple">
          <mx:Text text="Information Services Portal" fontSize="20"
          color="blue"/>
          </mx:Panel>
          ------------------------------------------------------------------------------------
          ---------- components/Payroll.mxml ------------------
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Panel xmlns="*" xmlns:mx=" http://www.adobe.com/2006/mxml"
          width="100%" height="100%" horizontalAlign="center" backgroundColor="gray">
          <mx:Text text="Payroll Portal" fontSize="20"
          color="blue"/>
          </mx:Panel>
          • 2. Re: how connect to another application by using linkbar
            Gregory Lafrance Level 6
            I should mention that if you want to instead navigate to another web page, which might even be another HTML wrapper to one of your Flex SWF, you could use the navigateToURL() method. But in general ViewStack is great for navigating around the components of your Flex app. Foe navigateToURL(), you use these flags to determine if a new window is opened, or if the new page appears in the current window:
            _self Specifies the current frame in the current window.
            _blank Specifies a new window.
            _parent Specifies the parent of the current frame.
            _top Specifies the top-level frame in the current window.

            See these FB 2.0.1 help topic (or via the web with LiveDocs):
            Using the navigateToURL() method in Flex
            The navigateToURL() method syntax