2 Replies Latest reply on Nov 28, 2009 5:58 AM by Ned Murphy

    Making combo box write variables




      I am a dynamic site newbie, but have been making simple animations with Flash for some years.


      I have got a friend to give me a leg up to create a flash page full of input text boxes that write to a text file via PHP and are then dispayed in dynamic text boxes. ( http://www.thepastafactory.co.uk/forsale.html ) I want to replace some of the imput text boxes with combo boxes. eg if the combo box has the options of say "rigid" or "trailer" it would write which ever was selected in the text file so this would be displayed in the dynamic text box for the end user to see. It seems very simple but I have looked all over the options for combo boxes and can see no mention of variables.


      Can anyone explain to me in simple terms how I can achieve this.


      Many thanks



        • 1. Re: Making combo box write variables
          kglad Adobe Community Professional & MVP

          you can use the combobox addItem, addItemAt and getItemAt methods to edit the labels and data of combobox items.

          1 person found this helpful
          • 2. Re: Making combo box write variables
            Ned Murphy Adobe Community Professional & MVP

            As a simple example for yourself, open a new file and add a combo box and a dynamic textfield to the stage.  Assign them instance names of my_cb and cbTextField, respectively.  Then add an actions layer and place the following code in it...


            // Add Items to List.
            my_cb.addItem({data:1, label:"First Item"});
            my_cb.addItem({data:2, label:"Second Item"});
            my_cb.addItem({data:3, label:"Third Item"});
            my_cb.addItem({data:4, label:"Fourth Item"});



            var listenerObject:Object = new Object();
            listenerObject.change = function(eventObject:Object) {
                  cbTextField.text = my_cb.selectedItem.label;
            my_cb.addEventListener("change", listenerObject);

            1 person found this helpful