[AS2] xmouse coordnates play MC.. halp!

hi… im trying to make a mc start playing by moving the mouse (_xmouse) of to the right side… I need to make the mc paly without the use of a rollover button when the mouse passes over a the last 100 or so pixels to the right… i been trying to modify this scrip to do the job but it currently plays the mc with every little move of the mouse.

var mouseListener:Object = new Object();

mouseListener.onMouseMove = function() {
if (root._xmouse, true) {
mymovieclip.play(1);
}
else if (_xmouse, false) {
mymovieclip.gotoAndStop(1);
}
};

Mouse.addListener(mouseListener);

any ideas?

var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
	if (_xmouse < 100) {
		mymovieclip.play();
	} else {
		mymovieclip.gotoAndStop(1);
	}
};

Great… that worked with a little ajusting :stuck_out_tongue: thanks… any ideas how i can make it play once and stop? It ceeps playing over and over when i move the mouse with this code…

Again… thanks… this has been haunting me all wekend!

You’ll need to set up a condition to check if the movie has been played, e.g.
played = false;
if (_xmouse < 100 && !played) {
mymovieclip.play();
played = true;
}

hmm… i cant seem to make that work. exactly where where in the script should the condition be palced?
This is more advanced actionscripting compared to what im used to doing :S

Add played = true; to the last frame in mymovieclip.
Then change your code to this:

mymovieclip.stop();
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
	if (_xmouse < 100 && !mymovieclip.played) {
		mymovieclip.play();
	} else {
		mymovieclip.gotoAndStop(1);
	}
};
Mouse.addListener(mouseListener);

thanks, im learning alot here… and with this im almost there… now i just need the movieclip to stop and freeze in the last frame, and not pop back to start at the next mouse movement… im guessing i need another variable but im in over my head now… if you have a solution for me i wold be extremly grateful…

I assumed that you wanted it to continue looping. To get it to stop, just add stop(); to the last frame of the mc as well.

well… heres the thing, my movieclip is a shhet of paper beeing flipped… i want it to stay flipped so the page underneath is shown. -so i dont want it to loop… i want it to play once and stay “open” -frosen at the last frame…

thanks for your ansvers and patirence :slight_smile:

any advice? im still stuck :-/

i solved it :D:D you where right, just needed a stop at the right place… thank you so mutch :smiley: