# \[Flash8\] Help needed with AS2 classes

**URL:** <https://forum.kirupa.com/t/flash8-help-needed-with-as2-classes/320314>\
**Category:** flash\
**Created:** [March 20, 2011, 9:35am UTC](https://forum.kirupa.com/t/flash8-help-needed-with-as2-classes/320314 "2011-03-20T09:35:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigEnglisHoward](https://avatars.discourse-cdn.com/v4/letter/b/b782af/32.png) [@BigEnglisHoward](https://forum.kirupa.com/u/BigEnglisHoward)\
**Post date:** [March 20, 2011, 9:35am UTC](https://forum.kirupa.com/t/flash8-help-needed-with-as2-classes/320314/1 "2011-03-20T09:35:10Z")

</div>

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
