2 Replies Latest reply on Dec 20, 2007 12:33 PM by Garyl Woolworth

    ComboBox

    GeorgeWS Level 1
      I have a combo box that I want to use to navigate from one app to another.

      [Bindable]
      public var Tools: Array = [ {label:"App 1", data:"App1"}, {label:"App 2", data:"App2"}, {label:"App 3",data:"App3"}];

      [Bindable]
      public var selectedItem:Object;

      <mx:ComboBox id="myTools" dataProvider="{Tools}" width="80"
      close="selectedItem=ComboBox(event.target).selectedItem"/>

      How do I use this to navigate to another App?

      Im sure I will need to use the navigateToURL but I just cant put it together does anyone know how?

      Thanks
      George
        • 1. ComboBox
          xrum Level 2
          add a function on to read the event:
          <mx:ComboBox click="CheckWhereToGo()" />


          in your script part of the program, you would have to do an IF

          <script>
          CheckWhereToGo()
          {
          if myTools.selectedItem=App1
          {
          navigatetoUrl( http://myfirstapp);
          }

          and keep going with your ifs.....


          hope this helps

          this seems like a very simple quesiton (considering that you'r a Senior member). not sure, maybe i misunderstood yoru questions...
          • 2. ComboBox
            Garyl Woolworth Level 1
            When you say application I'm assuming your talking about separate pages seeing as you mentioned navigateToURL.
            instead of using a whole bunch of if statements store the location of the app inside of the dataProvider. An example would be this.

            [Bindable] public var Tools:Array = [
            {label:"None", data:""},
            {label:"App 1", data:" http://google.com"},
            {label:"App 2", data:" http://hotmail.com"},
            {label:"App 3", data:" http://yahoo.com"}
            ];

            <mx:ComboBox id="myTools" dataProvider="{Tools}" width="80" close="(ComboBox(event.target).selectedItem.data != '') ? navigateToURL(new URLRequest(ComboBox(event.target).selectedItem.data), '_blank') : ''"/>