dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: comboBox + MC / change color

  1. #1
    Between Flash & Flashkit timothye's Avatar
    Join Date
    Dec 2003
    Location
    Sweden
    Posts
    1,666

    comboBox + MC / change color

    hi ..
    i have a comboBox + a mc on the stage . i am trying to make a selection from the comboBox to change the color of the movie clip .. i really need some help on this .thanks .
    see fla
    or here is the code
    Code:
    //populate the comboBox
    my_cb.addItem({data:"", label:"Select a Color"});
    my_cb.addItem({data:"0x0000FF", label:"Blue"});
    my_cb.addItem({data:"0xFF0000", label:"Red"});
    my_cb.addItem({data:"0x000000", label:"Black"});
    my_cb.addItem({data:"0x009900", label:"Green"});
    // comboBOx on change
    var colorListener:Object = new Object();
    colorListener.change = function(evt_obj:Object) {
    	var Selected:Object = evt_obj.target.selectedItem;
    	ball_mc.color = +evt_obj.selectedItem.data;
    };
    my_cb.addEventListener("change", colorListener);
    I want to learn .
    wannabe flasher [ Actionscript 2.0 ]

  2. #2
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    The following worked for me:

    var aCollor:Color = new Color(ball_mc);
    my_cb.addItem({data:"", label:"Select a Color"});
    my_cb.addItem({data:"0x0000FF", label:"Blue"});
    my_cb.addItem({data:"0xFF0000", label:"Red"});
    my_cb.addItem({data:"0x000000", label:"Black"});
    my_cb.addItem({data:"0x009900", label:"Green"});

    var colorListener:Object = new Object();
    colorListener.change = function() {
    trace (my_cb.selectedItem.data)
    aCollor.setRGB(my_cb.selectedItem.data)
    };
    my_cb.addEventListener("change", colorListener);
    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
    brilliant m8 .
    thanks for that 1 .
    cheer MGT
    I want to learn .
    wannabe flasher [ Actionscript 2.0 ]

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