A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Component problem

  1. #1
    Registered User
    Join Date
    Jun 2014
    Posts
    2

    Component problem

    Code:
    var combo_selector:Object = new Object();
    combo_selector.addEventListener("change", combo_selector);
    
    combo_selector.change = function()
    {
    	trace("Alright");
    }
    Hi

    I'm in trouble having above code to work. I have this combo box and i'm trying to trace() a message when one of the the combo item change. What i'm doing wrong here?

    Thanks

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You need to give the object a different name to the combobox.
    PHP Code:
    combo_selector.addItem("a","a");
    combo_selector.addItem("b","b");
    combo_selector.addItem("c","c");
    combo_selector.addItem("d","d");

    var 
    comboAction = new Object();
    comboAction.change = function(eventObj)
    {
        
    trace("Value changed to " eventObj.target.value " : Alright");
    };

    combo_selector.addEventListener("change",comboAction); 
    essentially you needed to change a couple of names as they clashed

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