ActionScript 3.0 Lesson 13: Flash Drag and Drop

Wed, Aug 12, 2009

ActionScript

This movie requires Flash Player 9


CLICK HERE FOR A LIVE DEMONSTRATION OF THE TUTORIAL

On this tutorial we show how to start the drag through an event listener. The event listener will fire a function that starts the drag, stops the listener for mouse down and starts waiting for release.

DOWNLOAD THE SOURCE FILE HERE

DOWNLOAD THE TUTORIAL TO YOUR HARD DRIVE


Here is the Code!!
// Circle Flash Drag and Drop
// by Avraham Saltoun solutions at say-web dot com
// FREE to use, copy and Distribute.

//It all starts with an Event Listener

Circle_mc.addEventListener(MouseEvent.MOUSE_DOWN, Drag);

/*

The _mc enables CODE HINTING for Movie Clip
(The drop down with suggestions)

When the mouse button is clicked the compiler
will look and go for the Drag function */

function Drag (e:MouseEvent): void {

// The e represents the value beign recieved
// void is good practice to state no value
// will be return. Would work without it!

Circle_mc.startDrag();
Circle_mc.removeEventListener(MouseEvent.MOUSE_DOWN,Drag);
Circle_mc.addEventListener(MouseEvent.MOUSE_UP, Drop);

}

function Drop (e:MouseEvent):void

// Let’s copy and paste
// This will release the circle
// from the mouse!

{
Circle_mc.stopDrag();
Circle_mc.removeEventListener(MouseEvent.MOUSE_UP,Drop);
Circle_mc.addEventListener(MouseEvent.MOUSE_DOWN, Drag); }

// Thanks for Watching !!!!

Related Articles:

, , , , , , , , , , , , , , ,

One Response to “ActionScript 3.0 Lesson 13: Flash Drag and Drop”


Trackbacks/Pingbacks

  1. [...] Drag and Drop code can be found here: http://say-web.com/2009/08/12/actionscript-3-0-lesson-13-drag-and-drop-removing-event-listener/ HERE IS THE SOURCE CODE! //The ActionScript 3.0 Calculator Display // Avraham Saltoun // solutions [...]

Leave a Reply

Security Code:

AVA Trading Forex
WIX create a FREE website.
Try ACT! 2010 Today
Accept Credit Cards
UseNeXT Fast Downloads
For Free Stuff Click Here

Get Paid for Filling Surveys


Go Daddy $7.49.com sale 125x125 Huddle Collaboration
oDesk Certified Action Script Programmer oDesk Certified Adobe Flash CS3 Designer oDesk Certified Adobe Photoshop 6.0 Designer

Compare Web Hosting Services and Prices

web hosting - Web Hosting guide to popular hosts.

Twitter Followers