I’m becoming more familiar with actionscript coding inside my FLA’s but I am just starting to look at classes in AS2.
I have extended the MovieClip class to create a class called “machine” which I can get to appear in my SWF by linkage and then using attachMovie. However my machine movieclip has a button on it (instance name is theButton_btn) which I thought I would be able to control through the class -as per my newb code below.
The button is intended to always do the same thing to all instances of “machine”
class machine extends MovieClip
{
//other stuff, then…
var myButton=this.theButton_btn;
myButton.onRelease = function(){
trace(“do something groovy”);}
}
However this gives me a compiler error, “This statement is not permitted in a class definition”
Can someone point me in the right direction, please? Many thanks, H