dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Quick ComboBox Help

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    Magnolia, DE
    Posts
    124

    Quick ComboBox Help

    Ok, well I have searched and searched, and have not gotten this to work right. I have a combo box with 10 different choices. Here's what I need:

    When someone changes the selection, I need the flash movie to gotoAndStop() on a frame.


    The 10 choices are
    Quote Originally Posted by ComboBox
    J&M Red
    Black
    Pink
    Orange
    Green
    Gray
    Brown
    Yellow
    Blue
    Baby Blue
    When they pick one of those, I want it to gotoAndStop("xcolor"); . For example if they picked Black, I want it to gotoAndStop("black");. Sorry if I made this write-up too unclear for you. Any help will be greatly appreciated. I want it to change after every time they change the color. Thanks in advance!

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Do the frame labels and the values displayed in the combobox exactly match?

    If so:
    var comboListener:Object = new Object ();
    comboListener.change = function(){
    _root.gotoAndPlay(instanceNameOfComboBox.selectedI tem.label)
    }
    instanceNameOfComboBox.addEventListener("change", comboListener)
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  3. #3
    Between Flash & Flashkit timothye's Avatar
    Join Date
    Dec 2003
    Location
    Sweden
    Posts
    1,666
    so your code should look like this
    Code:
    stop();
    //populate the combobox
    my_cb.addItem({data:black, label:"Black"});
    my_cb.addItem({data:Red, label:"Red"});
    // Add event listener and event handler function.
    var comboListener:Object = new Object();
    comboListener.change = function() {
    	_root.gotoAndStop(my_cb.selectedItem.label);
    };
    my_cb.addEventListener("change", comboListener);
    with labels on your time line called black , red .
    my_cb as the instance name of the comboBox
    on "change " it will goto and stop at these lables . black or red

    cheers ..


    cheers Kortex just some added help .
    I want to learn .
    wannabe flasher [ Actionscript 2.0 ]

  4. #4
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Not a prob. Feel free to add any time and crrect me when I say something screwy (and I will from time to time)
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  5. #5
    Senior Member
    Join Date
    Apr 2003
    Location
    Magnolia, DE
    Posts
    124
    Thank both of you very much! That helped alot! Just one thing, the first choice and the last choice do not do anything but all the others work fine. This is most likley my own problem, but I was just wondering if it had anything to do with the script.
    Thanks again!

  6. #6
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Do you have Fames Labeled

    J&M Red
    Baby Blue

    that match exactly case and all?
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  7. #7
    Senior Member
    Join Date
    Apr 2003
    Location
    Magnolia, DE
    Posts
    124
    It works fine now, I made a simple mistake. Thanks for all of your 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