6 Replies Latest reply on Jan 26, 2009 3:53 AM by fungus13

    Combo Box control with Actionscript

    fungus13

      I have created a menu for an online café. The display area is limited, so the menu items need to scroll within a frame of some sort. The menu items come in various sizes for example “small”, “medium”, “large”.
      Each size has a different cost. E.g. “Cappuccino” has “Cappuccino Small”, “Cappuccino Medium”, “Cappuccino Large” with prices say “3.00”, “6.00”, “9.00”.

      I have set up a Combo box to display each menu item. Displayed is the minimum code that shows this.
      var myCappuccinoBox:ComboBox = new ComboBox();
      :
      myCappuccinoBox.addItem({label:"Orange Small"});
      :
      myCappuccinoBox.move(30, 165);
      addChild(myCappuccinoBox);

      I have a separate Combo box for the number of items
      var myCappuccinoNoBox:ComboBox = new ComboBox();
      :
      myCappuccinoNoBox.addItem({label:"2"});
      :
      myCappuccinoNoBox.move(130, 195);
      addChild(myCappuccinoNoBox);

      The total for all drink items has an instance name “tbDrinkTot”

      To scroll the menu items in the small display area I have nested/embedded the movieclip into a scrolling movie. At the moment I have used button controls to move the menu up and down. Any better suggestions on how to scroll the menu gratefully received. Currently I’m using the clickHandler functions

      function clickHandler1(event:MouseEvent):void {
      this.mcDrinkMenu.play();
      }
      btPlay.addEventListener(MouseEvent.CLICK, clickHandler1);
      Questions in next post
        • 1. Re: Combo Box control with Actionscript
          fungus13 Level 1
          Problem1
          How does one reset the ComboBox to the “Home” position using ActionScript (CS3)? I tried using “myCappuccinoBox.setSelectedIndex(0);” with button Click. Among a variety of other attempts this seemed the most likely solution, but still gave an error “call to undefined method through a reference with static type fl.controls.ComboBox”. Do I have to add some other access statement e.g. “fl.controls.?????”. Does someone know how to reset my menu items?

          • 2. Re: Combo Box control with Actionscript
            fungus13 Level 1
            Problem2
            I have a number of menus, “Food”, “Drink” in different frames. I can add up the items in one frame, eg total drinks, but am unsure how to add up the total of all the menus e.g. food hot, food cold, drink hot, etc – e.g. transfer data one frame to another.
            I do not have access to a server, to store data in a database. I use an iMac and am not sure how to set up a local MySQL environment.
            I tried setting up a SharedObject, but I am unsure how to access the (Totals) data in the ComboBox as the movie is nested. Any suggestions gratefully received

            • 3. Re: Combo Box control with Actionscript
              fungus13 Level 1
              Second part of Problem 2
              The movie containing the Combo boxes (Library item) = DrinkMenuMC
              But was physically placed in the scroll movie so has no instance name
              The scroll movie containing the menu item is (Library item) = ScrollMenuMC
              The scroll movie has an instance name “mcDrinkMenu” in the main Timeline.
              Both the DrinkMenuMC and “ScrollMenuMC have been “exported for ActionScript” with the same relative Class names.

              I tried to access the data to save it as a shared object field on the main timeline,
              e.g.
              menu.data.drinkTotal = this.DrinkMenuMC.tbDrinkTot.text; or
              menu.data.drinkTotal = this.ScrollMenuMC.DrinkMenuMC.tbDrinkTot.text;

              Obviously neither worked. Can anyone advise on this process. The problem I think is that I’m not doing this process purely as code, and the pathname may be affected by this. I would like to understand the movie nesting process a little better. Is there a good reference on the structure
              • 4. Re: Combo Box control with Actionscript
                fungus13 Level 1
                Problem 3
                Scrolling is a bit crude using the simple play and reverse functions. I would like to set up a system more like the common application scrollbars e.g. two arrows that jump short distance when clicked and scroll continuously when held down. Any suggestions?

                • 5. Re: Combo Box control with Actionscript
                  fungus13 Level 1
                  Problem4
                  Less of an issue as I have found a crude solution. I tried to set up the window using a mask, but found the buttons didn’t work and the items and costs (text boxes, combo boxes) didn’t display. Is there a solution?

                  • 6. Re: Combo Box control with Actionscript
                    fungus13 Level 1
                    PS note the error in the description - Orange small should be "Cappuccino Small" obviously, I'm doing a cold drink menu too, hence the "orange"