Simple Drag / Drop in flash

Multi Level Dropdowns in NewForm

Step 1: Create one MovieClip

Step 2: Paste some random image in to the movieclip

Step 3: Go back to scene1 and drag Hand Movie from library and give instance
name to this movie clip (Best practice, in AS3 instance name should be different
from movieclip name)


 –

Step4: Actionscript code (When user mouse downs on the movieclip , startDrag
function needs to be initiated. Once mouse up, stop drag function needs to be
called)

AS3
HandIns.addEventListener(MouseEvent.MOUSE_DOWN,startDragFunction)
HandIns.addEventListener(MouseEvent.MOUSE_UP,stopDragFunction)

function startDragFunction(e:Event):void
{
e.target.startDrag();
}
function stopDragFunction(e:Event):void
{
e.target.stopDrag();
}

AS2
HandIns.onPress=startDragFunction  
//On Press is equivalent to mouse down
HandIns.onRelease=stopDragFunction // on
Release is equivalent to mouse up
function startDragFunction()
{
this.startDrag();
}
function stopDragFunction()
{
this.stopDrag();
}
 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.