Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
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.."?
Copy link to clipboard
Copied
The box is a black box graphics which only appears in frame 2 but not in frame 1. Thanks for your reply.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
should be without quotes
gotoAndPlay(2);
&
gotoAndStop(1);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now