Flash MX Actionscript Dragging
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.
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)

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