0

Trying to trigger an animation on mouse hover and reversing it from the current point when the mouse leaves a symbol, I have this code. It works when hovering over symbol A to animate symbol A. How can I access a different symbol so that I can animate symbol B on hovering over symbol A?

Edit: More concretely, how can I access a symbol different from the one the code is assigned to?

I am trying to create a pie chart with individual slices moving away from the center of the chart on mouse hover, if this was possible to animate with HTML, CSS, JS a hint would be very much appreciated so I could give it a try like that.

this.stop();
this.addEventListener(MouseEvent.MOUSE_OVER,mover);
this.addEventListener(MouseEvent.MOUSE_OUT,mout);

function mover(e:MouseEvent):void {
    stopPlayReverse();
    this.play();
}

function mout(e:MouseEvent):void {
    this.addEventListener(Event.ENTER_FRAME, playReverse, false, 0, true);
}

function playReverse(e:Event):void {
    if (this.currentFrame == 1) {
        stopPlayReverse();
    } else {
        this.prevFrame();
    }
}

function stopPlayReverse():void {
    if (this.hasEventListener(Event.ENTER_FRAME)) {
        this.removeEventListener(Event.ENTER_FRAME, playReverse);
    }
}
  • Any particular reason why you're not doing this in HTML + js? There are plenty of reasons to not use flash for button events in 2019. – Luciano Mar 19 at 11:12
  • Unfortunately I wouldnt know how to do it in HTML & js either. This is intended as a presentation that will not be publicly available and I really hope to solve it this way as I already invested time in the animations. – ljf Mar 19 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.