• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ActionScript 3.0 Mouse Over and Mouse Out scripting error

New Here ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

Trying to figure out a way to reverse a movie clip when I Mouse out.

here's my code right now:

Image_zoom.stop();

Image_zoom.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_3);

function fl_MouseOverHandler_3(event:MouseEvent):void

{

    Image_zoom.play();

}

It plays the video when I hover over with my mouse but when I move my cursor off it pauses the movie clip. Can it reverse on a mouse out regardless of play point.

Anything will help!

Thanks!

TOPICS
ActionScript

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2018 Mar 08, 2018

Copy link to clipboard

Copied

LATEST

Hi.

This should do it:

import flash.events.MouseEvent;

import flash.events.Event;

import flash.display.MovieClip;

var mc:MovieClip = rec;

function mouseHandler(e:MouseEvent):void

{

    if (e.type == MouseEvent.MOUSE_OVER)

    {

        mc.forward = true;

        stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);

    }      

    else if (e.type == MouseEvent.MOUSE_OUT)

        mc.forward = false;

}

function enterFrameHandler(e:Event):void

{  

    if (mc.forward)

        mc.nextFrame();

    else if (mc.forward == false)

        mc.prevFrame();

  

    if (mc.currentFrame == 1)

        stage.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);

}

mc.stop();

mc.mouseChildren = false;

mc.addEventListener(MouseEvent.MOUSE_OVER, mouseHandler);

mc.addEventListener(MouseEvent.MOUSE_OUT, mouseHandler);

I hope it helps.

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines