Hi
I was wondering if you code help me out with Actionscript 2.0 and classes.
I have built a movie which has some nested movies within. I have created a class called ButtonMc in a .as file and used linkage to connect the symbol in the .FLA file with the class code in the ButtonMc.as file . This is the code for ButtonMc class:
class ButtonMc extends MovieClip
{
//stores the MovieClip Instance which will be assigned to this class
private var mcButton:MovieClip;
/* Constructor - takes in the movieclip*/
public function ButtonMc(mcInstance:MovieClip, mcInstanceName:String, mcInstanceDepth:Number, xPos:Number, yPos:Number)
{
//mcInstance will hold value "this"- which will mean a [COLOR=Black][COLOR=darkgreen][U]connection[/U][/COLOR][/COLOR][U][COLOR=Black] [/COLOR][/U]will be made
//between this objects (when created) movieclip property and the symbol in the .fla.
mcButton = mcInstance.attachMovie("ButtonMc", mcInstanceName, mcInstanceDepth);
//set the initial position of movie on stage
setPosition(xPos, yPos);
//dont display the handcursor for this movie clip
mcButton.useHandCursor = false;
//starts the onrollover event
}
/* Sets/Changes the position of the movie clip on stage*/
public function setPosition(x:Number, y:Number)
{
mcButton._x = x;
mcButton._y = y;
}
/* when mouse rolls over */
public function onRollOver()
{
mcButton.gotoAndPlay("over");
}
}
Then on my _root(main timeline) i have a action to create an instance of the the class and display the movie. I have this action:
var mc:ButtonMc = new ButtonMc(this, "mcunderstand", 0, 10, 50);
This movieclip displays when run, but nothing happens when i rollover the movieclip, it does not work and does not go to and play the specified frame for the “over” state.
Am i doing this wrong? I thought that all code related to an object would go inside the class and be ready to use?
Any help on this would be great
Thanks alot.