3 Replies Latest reply on Dec 25, 2007 11:18 AM by NickMonk

    ComboBox Component Not Working For Flash Slide Presentation

    NickMonk
      Hello Everyone!

      I've created a Flash Slide Presentation using the ComboBox Component in Action Script 2.0. I created a ComboBox to be able to navigate between the slides. My ComboBox has an instance name of PageChoice. My slides have instance names of HPage1, HPage2, and HPage3. My ComboBox label parameter is set to 1, 2, and 3. My ComboBox data parameter is set to HPage1, HPage2, and HPage3. The code below creates no compile errors, but doesn't work. Clicking on the ComboBox choice results in no navigation to the appropriate slide. I get the same result whether I'm using Macromedia Flash MX Professional 2004 or Adobe Flash CS3 Professional. What am I missing here?

      Thanks for your help!

      Nicholas


      var myComboBoxListener:Object = new Object();

      myComboBoxListener.change = function() {
      _root.currentSlide.gotoSlide(_root.PageChoice.selectedItem);
      }

      PageChoice.addEventListener("change", myComboBoxListener);
        • 1. ComboBox Component Not Working For Flash Slide Presentation
          NickMonk Level 1


          Hiya Everyone!

          What's interesting about this problem is that if I put the code below only on the ComboBox Component Actions vice the event handler code on frame 1, action will progress to that one slide only, HPage1 in this case.

          on(change) {
          _parent.currentSlide.gotoSlide(_parent.HPage1);
          }

          What I don't get is why Flash Action Script 2.0 doesn't just allow this code on the Combox Component Actions.

          on(change) {
          _parent.currentSlide.gotoSlide(_parent.PageChoice.selectedItem);
          }

          This would be intuitive to me, instead of all this event handler stuff that's not working because I'm missing some piece of logic.

          Nicholas
          • 2. ComboBox Component Not Working For Flash Slide Presentation
            NickMonk Level 1


            Hiya Everyone!

            I added the code below to test whether my event handler detects the ComboBox selections. It does, so the problem here is with the attempt to go to a slide. Still trying to figure out why it isn't working. The output from TRACE shows the correct label and data being selected, I just can't get the going to a slide to work...yet!

            var MyComboBoxListener:Object = new Object();

            MyComboBoxListener.change = function(MyComboBoxChoice:Object) {
            trace("Currently selected label is: " + MyComboBoxChoice.target.selectedItem.label);
            trace(" Currently selected data is: " + MyComboBoxChoice.target.selectedItem.data);
            _parent.currentSlide.gotoSlide(_parent.MyComboBoxChoice.target.selectedItem.data);
            }

            PageChoice.addEventListener("change", MyComboBoxListener);

            Nicholas
            • 3. Re: ComboBox Component Not Working For Flash Slide Presentation
              NickMonk Level 1


              Hiya Everyone!

              Well, after investigating by running traces, I finally figured out this code. Note how the slides are referred to as "_level0.Welcome.slide" at the root. Note how the gotoSlide() statement requires a literal input of the slide, such as HPage1. Any non-direct reference to the slide results in a blank screen, for instance, if I used gotoSlide(PageChoice.value). Can anyone explain this, or are we just stuck using a switch statement to properly navigate slides from a ComboBox Component?

              Thanks!

              Nicholas


              var MyComboBoxListener:Object = new Object();

              MyComboBoxListener.change = function() {
              switch(PageChoice.value) {
              case "Logo":
              _level0.Welcome.gotoSlide(Logo);
              break;
              case "HPage1":
              _level0.Welcome.gotoSlide(HPage1);
              break;
              case "HPage2":
              _level0.Welcome.gotoSlide(HPage2);
              break;
              case "HPage3":
              _level0.Welcome.gotoSlide(HPage3);
              break;
              case "HPage4":
              _level0.Welcome.gotoSlide(HPage4);
              break;
              case "HPage5":
              _level0.Welcome.gotoSlide(HPage5);
              break;
              case "HPage6":
              _level0.Welcome.gotoSlide(HPage6);
              break;
              case "HPage7":
              _level0.Welcome.gotoSlide(HPage7);
              break;
              case "HPage8":
              _level0.Welcome.gotoSlide(HPage8);
              break;
              case "HPage9":
              _level0.Welcome.gotoSlide(HPage9);
              break;
              case "HPage10":
              _level0.Welcome.gotoSlide(HPage10);
              break;
              }
              }

              PageChoice.addEventListener("change", MyComboBoxListener);