Monday, April 11, 2011

Flash AS 3.0 Drag and Drop

Use the mouse to click onto the basket of eggs, hold down the mouse button, and move the eggs across to the Stickman. Once the basket is in the Stickman's hands, release the mouse button to leave them there.

This is a basic Flash Actionscript 3.0 animation, and uses what is know as "Drag and Drop" functionality.

We drew the Stickman using the Flash tools, and placed him on the stage.

Next we used the Flash "T" text lettering tool and made the heading using a font called "Jokerman" with a font size of 30.

We then found a picture of a basket of eggs on the web, saved it to our local folder, and then used "File > Import > "Import to Library" to bring it into Flash.

The eggs were then modified to become a "Movie Clip" image and given an instance name in the properties of "mc_eggs". We could then use this name to connect them to the following Actionscript 3.0 code.

AS3 code from PW

Separate lines of code, add event listeners for the mouse up and mouse down events, with the parameters of drag and drop.

The drag function starts the dragging of the object when the mouse is pressed, and the drop function stops the dragging of the object when the mouse is released.

The following 11 minute YouTube video gives detailed step by step instructions on how to make this Drag and Drop project in Adobe Flash CS3.

For maximum clarity, watch the video full screen in HD by clicking the bottom right hand corner controllers in the YouTube player.

So that's it for our Drag and Drop introduction. This technique can be used to make a variety of interactive Flash animations, and so it is well worth mastering.

Time for me to drag myself away from the computer and drop into some guitar practice.

Big Passy Wasabi

No comments:

Post a Comment