Here is a example on how to make a movie play, ONLY when the mouse is moved across the X coordiant.
This is achieved by placing a "stop();" function on every frame in the sprite that you want to apply this to. In my case, I used 50 pictures of me attempting to dance... =/ lol
onEnterFrame(){ co = _root._xmouse; }
The varible "co" now holds the X cooridant of the cursor on the page. I placed this in a sprite that is countinuously playing (e.g. no "stop();" functions), just so the varible "co" would keep updating itself.
Then, I said,
If(co >=300 && co <= 314){ _root.dance.gotoAndPlay(1); }
This says, the condition is only met if the mouse X coordiant is greater than or equal to 300, AND less than or equal to 314.
Now, you might ask why they are all funny numbers... you don't have to make your numbers the same for it to work. You can use any numbers you like... it just so happens the cartoon I personally am working on is placed at X - 300, so that is where I started. I used 50 pictures, and I wanted it to start when rolling over the front edge of the cartoon, and stopping at the back edge. So, the distance from the front to the back was just about 700 pixels. So, 700 divided by 50 = 14. So, every 14 pixels, I want it to go to another picture, starting from 300. Like I said, you don't have to know that part for it to work, that was just how I had my movie setup.
If you don't understand... feel free to ask.
-Tote
EDIT:
I forgot to add something. You DO NOT need to have a "stop();" marker on every frame of the sprite if you use this code...
If(co >= 300 && <= 314){ _root.dance.gotoAndStop(1); }
All you have to do is place one "stop();" at the very first frame of the sprite you want to apply this to. Just continue to use "gotoAndStop()" instead of "gotoAndPlay()". And that's it.
|
|
|