I have taken the script from one of the tutorials on kirupa, about the mc easing to mouse position, and adapted it to scale a navigation “window”. The script looks like this
My question is if this is an efficient way of doing it. I have this script attached to 3 mc’s so Flash will continually check these 3 clips now? Does this take up to many resources? Is there a better way of doing it, without using onClipEvent? Sort of like, once the windows are scaled to 100%, I want Flash to forget checking them.
You can use dynamic event handlers, which you can delete whenever you wish.
… That would be something like this:
[AS]clip._xscale = 0;
clip._yscale = 1;
speed = 3;
clip.onEnterFrame = function() {
if (this._xscale<99) {
endX = 100;
this._xscale += (endX-this._xscale)/speed;
} else if (this._yscale<99) {
endY = 100;
this._yscale += (endY-this._yscale)/speed;
} else {
delete this.onEnterFrame;
}
};[/AS]
Where clip is the instance name of your MovieClip.