I am trying to add mouselisteners to a movieclip on my stage, by utilizing basically an activate class.
I want to do this to save alot of code clutter on my main stage.
Here is what I did:
drew a simple movieclip, and linked it to action script with:
Class: project.buttons.gridButton
Baseclass: flash.display.MovieClip
actions on my main stage:
import gridButton.*
var a:gridButton = new gridButton();
a = activateGrid (myMc);
buttonGrid.as:
package project.buttons {
public class gridButton extends MovieClip{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public function activateGrid(myMc:MovieClip) {
myMc.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
myMc.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
myMc.addEventListener(MouseEvent.CLICK, onClickHandler);
myMc.addEventListener(MouseEvent.MOUSE_DOWN, onPressHandler);
myMc.addEventListener(MouseEvent.MOUSE_UP, onReleaseHandler);
// if you want a hand cursor
myMc.buttonMode = true;
myMc.useHandCursor = true;
function onRollOverHandler(myEvent:MouseEvent) {
trace("Over");
}
function onRollOutHandler(myEvent:MouseEvent) {
trace("Out");
}
function onClickHandler(myEvent:MouseEvent) {
trace("I waited for Press AND Release!!!");
}
function onPressHandler(myEvent:MouseEvent) {
trace("Press");
}
function onReleaseHandler(myEvent:MouseEvent) {
trace("Release");
}
}
}
}
when I try to compile i get:
1017: The definition of base class MovieClip was not found.
I don’t understand what I’m doing wrong, can somebody give me some guidance?
Thanks.