I'm attempting to create a self-contained animated button. I.e, the scripting is within the movie clip, rather than on the main timeline, so I can use multiple instances of the button. The visual effect is mouseover to play 'in' (for example, circle becomes bigger), stop, then mouseover to play 'out' (circle becomes smaller again). My mc has 20 frames, with a simple a/b/a tween. My main script is on frame 1, and there's a this.stop() on frame 10. Mouse over should play the next frame. On mouse out it should go to the corresponding 'out' frame - i.e. if you move the mouse out while you are on frame 5, it should play frame 16: (20 - (5+1)). The code seems to work on mouse over, but is very flaky for mouse out. When I place the code on the main timeline and reference a specific instance name, it works better, but still the occasional glitch. Not sure if this is an error in my logic (probably), or something else. Any help would be appreciated. this.stop(); stage.enableMouseOver(10); this.addEventListener("mouseover", over.bind(this)); function over() { this.gotoAndPlay(this.currentFrame+1); } this.addEventListener("mouseout", out.bind(this)); function out() { this.gotoAndPlay(this.totalFrames-(this.currentFrame)+1); }
... View more