Hi,
This is more of a hypothetical than anything else… but lets suppose I have written a class called Monster that extends MovieClip.
I’ve also created a monster MovieClip that has a linkage identifier and an AS class tied to it (i.e. the Monster class).
How would I go about controlling the monster’s timeline from the AS 2.0 class? And subsequently controlling other timeline’s from within the monster MovieClip?
For example, the monster has 2 eyes, each one a MovieClip and capable of blinking or shutting. My goal is to write a method in the monster class that puts the monster to sleep (close both of his eyes) and another to wake him up (open his eyes again).
I haven’t tried this yet, but Im sure its not as straightforward as simply referencing the eye movieclips…
i.e. From within the monster class:
this.left_eye.gotoAndPlay(“blink”);
Does anyone follow whats going on? Anyone have any idea how I can accomplish this?
Here’s an example:
var monster = this.attachMovie("monster", "monster1", 1);
button1.onPress = function() {
monster.left.gotoAndStop("sleep");
monster.right.gotoAndStop("sleep");
}
When the above code is placed on the main timeline of the movie… it does as it should… the left and right eyeball instances each move to the designated frame on their timelines.
What I want is to put that code into the class file.
The following:
function sleep(){
this.left.gotoAndStop("sleep");
this.right.gotoAndStop("sleep");
}
When placed inside Monster.as doesnt work… can anyone help me bridge the gap here?
Cheers.