Having trouble utilizing event functions in a class.
I am trying to write button code in a class, so my main actions panal of my .fla doesn't get too overcrowded. Here is my class coding:
package grid {
import flash.display.*;
import flash.events.*;
public class g1x1 extends MovieClip {
public function activateGrid() {
this.addEventListener(MouseEvent.CLICK, onMouseClickEvent);
}
function onMouseClickEvent(event:Event):void {
trace("mouse clicked on me");
}
}
}
Then on my main timeline I call to that class using:
instance:g1x1 = new g1x1();
instance.activateGrid();
I have also tryed linking the button, using export for actionscript, but I don't know what I'm doing wrong I keep getting errors when I try to compile.
I know something is wrong with my code, I'm used to assigning code right onto the buttons in AS2.
Can sombody tell me what I'm doing worng?
Thanks
Matt.