5 Replies Latest reply on Feb 15, 2008 9:20 AM by Gregory Lafrance

    LinkButton issue

    Nutan.lade
      I want to navigate pages in my portal.I placed some linkbuttons in my application.Whenevr i click that button it should navigate to the respective page in my portal.please tell me how to do this.
      thanq
        • 1. Re: LinkButton issue
          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: LinkButton issue
            Nutan.lade Level 1
            I need how to navigate to a different page on my portal when i click LinkButton

            I had placed these code in one of my mxml application

            <mx:LinkButton x="71" y="160" label="Register"/>
            now when i clicked these i need to navigate to particular register page.
            • 3. Re: LinkButton issue
              Gregory Lafrance Level 6
              Inthat case you want the navigateToURL() method. 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
              • 4. Re: LinkButton issue
                Nutan.lade Level 1
                <mx:LinkButton x="71" y="160" label="Register" data="register" click="navigateToURL(new URLRequest('C:\Documents and Settings\Nutan\My Documents\Flex Builder 2\AlumniPortal\bin\Registration.mxml'), 'quote')"/>

                i already developed Registration.mxml application.But when i clicked i cannot navigate to that page.Please solve this problem.I also tried .html instead of .mxml.
                • 5. Re: LinkButton issue
                  Gregory Lafrance Level 6
                  You can't open an MXML file directly. It must be compiled into a SWF first. From what you describe, you can still use ViewStack. Just navigate to your registration page container in the ViewStack from the link button.