snakehips2000
Programmer
Why, when I add actionscript to a button created from a symbol, do I have to apply the code to the "On Release" event of the button to get it to work? Creating an event listener on the main timeline just ignores my code. Here's the example I'm using ...
I have a button created from two graphic symbols. I have designated the Up, Over, Down and Hit states, dragged an instance of the button to the stage and called it "btn". The states act as they ought but the action below is ignored:
var TestListener:Object = new Object();
TestListener.click = function() {
trace("hello")
}
//add the event listener to the button
btn.addEventListener("click", TestListener);
If I drag a button component to the stage and apply the listener to that instance - no problem.
I have a button created from two graphic symbols. I have designated the Up, Over, Down and Hit states, dragged an instance of the button to the stage and called it "btn". The states act as they ought but the action below is ignored:
var TestListener:Object = new Object();
TestListener.click = function() {
trace("hello")
}
//add the event listener to the button
btn.addEventListener("click", TestListener);
If I drag a button component to the stage and apply the listener to that instance - no problem.