Skip to main content
Participant
December 11, 2013
Question

Question on Rollover, Rollout

  • December 11, 2013
  • 2 replies
  • 630 views

Hi,

I am new to flash.  I created a frame in the main time line and in the main timeline I created a movie clips which has two frames.

What my code suppose to do is that when I rollover an object in unit 32, it will move to frame 2 in the movie clip(object with a box beside).  When I rollout an object, it will move back to frame 1(object only).

My problem is that the box remains on the stage even though the mouse already rollout of the object.  When I click it again, it becomes normal again.

Can someone help me... Many Thanks in advance.

KC

Main Timeline

Frame 1

stop();

--------------------------------------------

Movie Clip

Frame 1:

stop();

addEventListener(MouseEvent.ROLL_OVER, onMouseoverbtn1);

function onMouseoverbtn1(event:MouseEvent) :void {

          removeEventListener(MouseEvent.ROLL_OVER, onMouseoverbtn1);

          gotoAndPlay("2");

 

}

Frame 2:

stop();

var link1:URLRequest = new URLRequest("http://www.test.com");

addEventListener(MouseEvent.ROLL_OUT, onMouseoutbtn1);

addEventListener(MouseEvent.CLICK, onMouseclick);

function onMouseoutbtn1(event:MouseEvent) :void {

          removeEventListener(MouseEvent.ROLL_OUT, onMouseoutbtn1);

gotoAndStop("1");

}

function onMouseclick(event:MouseEvent) :void {

          navigateToURL(link1);

 

}

This topic has been closed for replies.

2 replies

Participating Frequently
December 12, 2013

should be without quotes

gotoAndPlay(2);

&

gotoAndStop(1);

kglad
Community Expert
Community Expert
December 11, 2013

what's this mean, "My problem is that the box remains on the stage even though the mouse already rollout of the object."?

in particular, what's "..the box.."?

Spidey09Author
Participant
December 11, 2013

The box is a  black box graphics which only appears in frame 2 but not in frame 1.  Thanks for your reply.

kglad
Community Expert
Community Expert
December 11, 2013

i can't see enough of the movieclip timeline to determine where on stage objects (like that black box) are located.

and you can use the trace function to confirm your rollover and rollout are doing what you want.