Flash MX Actionscript Dragging

13 Aug in flash

First you make an item such as a ball for example and turn it into a button. Make sure if you want to edit the button (Put sounds, change colors when your mouse is over the button, etc)DO IT FIRST BEFORE THE ACTIONSCRIPT. It screws it up if you do it after.01232006_134711.jpg



 

 

2: After You are done editing the item go into the Actions Bar at the bottom of the screen. Make sure that you are editing the Actionscript for the button not the frame. (Click The Picture To See Bigger Image)

01232006_135308.jpg

 

 

 

 

 

3: Here is the tricky part...


 

on (press) {
startDrag(this, false);
}

on (release) {
stopDrag();
}


Key: { = Star Command
} = End Command

Line 1 Means: On Press Of The Button {
Line 2 Means: Start Dragging This, False that The Pointer Is Always In Middle
Line 3 Means: End Of Command
Line 4 Means: On Realease Of The Button {
Line 5 Means: Stop Dragging The Item;
Line 6 Means: End Of Command


4: Finally you should test the movie...it works if when you click it you can drag it around and when you realse the mouse button it should stay in one place again.

 

Well I hope this little easy tutorial helps you in the future of flash making.
Thanks for reading.

 

Comments

Post new comment

 
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
By submitting this form, you accept the Mollom privacy policy.
Developed by NStudioCorp.com All trademarks and copyrights on this site are owned by their respective owners.
Comments are owned by the Poster. The Rest © 2000-2011 Firstov.com

About Firstov.com |  Terms of Service |  Support |  Contact Us |  Advertise