Assets contained in a Movie clip linked to a class (a movie clip subclass ) are not automatically accessible and must be explicitly declared in the class. For a button named 'myButton_mc' on scene, add in your class properties:
TO A BUTTON IN A MOVIE CLIP
Code:
var myButton_mc:MovieClip //..or Button but personnally I no more use button);
you can also declare a reference in one of the method
that is fired at class instanciation;
Code:
var myButton=this.myButton_mc; //could be a long path here
then use your event handler as usual;
Code:
myButton.onRelease=function(){
trace("myButton has been clicked")
}
No comments:
Post a Comment