A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: [b]help With Combo Box[/b]

  1. #1
    Junior Member
    Join Date
    Nov 2004
    Posts
    29

    [b]help With Combo Box[/b]

    I need help.

    What i want is a combobox and a dynamic text feild.

    I want the text to change when the user selects a different option from the combo box.

    i am using the UI combobox in MX 2004.

    if you could make an example (working) for me it would be good.

    Thanks

  2. #2
    aidanmack.co.uk
    Join Date
    Dec 2001
    Location
    York, UK
    Posts
    400
    lol
    u wont believe this but me and mate at work have just been workin on the same problem

    the flash file i want to send you is to big.
    U have an email address?
    its 314k

  3. #3
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    The example is originally from ultrashock.com. I modified and used it to demonstrate a problem with the combobox.

    http://flashscript.biz/components/comptricks/combo.html
    - The right of the People to create Flash movies shall not be infringed. -

  4. #4
    Junior Member
    Join Date
    Nov 2004
    Posts
    29

    Yes i do have an email address

    Send me the file to

    skyrider123@gmail.com

    thanks and don't wory i have 2gb of inbox space!!

    thanks for all of your help

  5. #5
    Junior Member
    Join Date
    Nov 2004
    Posts
    29
    Originally posted by cancerinform
    The example is originally from ultrashock.com. I modified and used it to demonstrate a problem with the combobox.

    http://flashscript.biz/components/comptricks/combo.html
    Hey could you let me at least have a demo file!

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Here
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Junior Member
    Join Date
    Nov 2004
    Posts
    29
    THANKYOU

  8. #8
    Junior Member
    Join Date
    Nov 2004
    Posts
    29
    Yes thats all good but if i say want to have a combobox:

    Blue
    Black
    Red

    ok,

    they are the values of the combo box (the values are the same)
    I want it so that when i click red is displeays text
    e.g. "hhhhhhhhhhhhhhhhhhhhhhhhs blah"

    When blue is selected
    e.g. "hnnndhhhhsvvvw blah blah blah"

    so the text does not always stay the same!!!!


    -----EDIT-----

    I want to achieve something like this:
    ----
    msg = if (myComboBox.label === black models) {
    "Another black";
    }
    ----
    msg = if (myComboBox.label === blond models) {
    "blonds are dumb";
    }
    ----

    So
    Last edited by skyrider123; 05-15-2005 at 02:47 AM.

  9. #9
    Junior Member
    Join Date
    Nov 2004
    Posts
    29

    no offence to blonds

    sorry to anyone who is a blonde out there

  10. #10
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Here is your answer. I eliminated the labels from the combobox and instead added them with AS. If you don't like this way there is another way as well but this is simple.
    PHP Code:
    //import the class
    import mx.controls.ComboBox;
    //
    //ceclare variables
    var myComboBox:ComboBox;
    var 
    statusMessage:TextField;
    //
    //add items and data to the combobox
    myComboBox.addItem({label:"blond models"data:"Blond models are beautiful."});
    myComboBox.addItem({label:"brunette models"data:"Brunette models are beautiful."});
    myComboBox.addItem({label:"brown models"data:"Brown models are beautiful."});
    //
    //create a listener
    var myComboBoxListener:Object = new Object();
    myComboBoxListener.change = function(eventObj) {
        
    //Combobox
        
    var eventSource:MovieClip eventObj.target;
        var 
    theSelectedItem:Object eventSource.selectedItem;
        
    //label: blond etc.
        
    var theSelectedItemLabel:String theSelectedItem.label;
        
    //data: Blond models...
        
    var theSelectedItemData:String theSelectedItem.data;
        
    statusMessage.text theSelectedItemData;
    };
    myComboBox.addEventListener("change"myComboBoxListener); 
    - The right of the People to create Flash movies shall not be infringed. -

  11. #11
    Junior Member
    Join Date
    Nov 2004
    Posts
    29
    Your way works great..

    But i found another way!!

    This code goes in my button!!
    PHP Code:
    on (realease) {
        if (
    mycombobox.value "value1") {
        
    text1.text "TEXT"  
      
    }

    Thankyou i reguire no more help!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center