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:

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

27 Responses to “ActionScript 3.0 Lesson 13: Flash Drag and Drop”


Trackbacks/Pingbacks

Leave a Reply

You must be logged in to post a comment.

My name is Avraham Saltoun, and I live in Jerusalem, Middle East. I am currently on my mid  40's and I am a computer programming technician. Here you will find over one hundred quality video tutorials on Actionscript, and yes, I give online support for aspiring programmers, and pros as well, sharing screen on skype and delivering source code by email, click the button for live flash actionscript support now!

 
oDesk Certified Action Script Programmer
oDesk Certified Adobe Flash CS3 Designer
oDesk Certified Adobe Photoshop 6.0 Designer
Skype Me™!

$7.49 .Com! Score Savings Cartoon Smart Tutorials


1,260
Unique Visitors
Previous 30 Days
Powered By Google Analytics