Skip to main content
Known Participant
April 26, 2011
Question

Cursor move back to (100,100)

  • April 26, 2011
  • 1 reply
  • 531 views

I have made a simple "maze game".

Player is sent to frame 10 if they reach the end goal or frame 20 if they accidentally "rollover" my walls (button). In frame 1, I successfully remove the mouse and add a Movie Clip to the Mouse/Cursor. I remove the MC when they go to frame 10 OR frame 20 and then when they replay and are sent back to frame 1. The MC again appears as the Cursor. GREAT.  Now here's my problem. When they are sent back to frame 1, I want the Cursor to be at an exact position to replay the game. Right now, it ends up wherever they have the cursor pointing and if it is touching my "walls", game over immediately. Here is the code I have on frame 1. It is working BUT I need to add code that makes the cursor ALSO go to a specific position.

stop();


lions_btn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_2);

function fl_MouseOverHandler_2(event:MouseEvent):void
{
gotoAndStop(20);
}


babySleep_btn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_3);

function fl_MouseOverHandler_3(event:MouseEvent):void
{
gotoAndStop(10);

}


stage.addChild(feather4_mc);
feather4_mc.mouseEnabled = false;
feather4_mc.addEventListener(Event.ENTER_FRAME, featherMouse);

function featherMouse(event:Event)
{
feather4_mc.x = stage.mouseX;
feather4_mc.y = stage.mouseY;
}
Mouse.hide();

THANK YOU for any suggestions, Gene

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 26, 2011

I am not sure I follow the story entirely, but it sounds like you need to avoid assigning the enterframe listener until the mouse moves to where the feather is sitting.  So maybe you should have a rollover assigned to the feather that calls a handler function that both assigns the enterframe listener and removes the rollover listener... and do the opposite at the end of the game to set up for the next

happyggv2Author
Known Participant
April 27, 2011

TX for your response Ned,

I have attached the current swf so you can more readily see my little

problem. The game seems to be working fine EXCEPT for the fact that when the

viewer "REPLAYS" the game, the cursor is sometimes parked right over one of

the rollovers (lions) and immediately goes back to "YOU LOSE" page. When the

viewer presses the REPLAY button, it goes to frame 1 BUT I want the cursor

to go to a specific SPOT when we go back to frame 1. (Like for example,

parked right over the start HERE text in the lower left.)

TX again for your thoughts. Gene

SORRY. I guess we can not attach an swf here in the forum huh ? I received your response in my email and simply "replyed" to it and attached the swf but I don't see it here in the post. Therefore, here is a link to a video I took of the game in action so you can see what the problem is. Thanks Gene

http://screencast.com/t/a3qcTm92Nmzw