Return to Kroll Design home page

Flash Tutorials (with .FLA files included)

 
« Return

ActionScript 3

Dragging using the startDrag and stopDrag methods

This example uses the built-in Flash methods of startDrag and stopDrag to allow you to move the walking man around the confines of the Flash movie by dragging with your mouse.

Download the FLA file



var walker_mc:Walker = new Walker();

walker_mc.x = 200;
walker_mc.y = 200;
walker_mc.scaleX = .5;
walker_mc.scaleY = .5;
walker_mc.buttonMode = true;

addChild(walker_mc);

walker_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownFunction);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpFunction);

function mouseDownFunction(myEvent:MouseEvent):void
{
	walker_mc.startDrag();
}

function mouseUpFunction(myEvent:MouseEvent):void
{
	walker_mc.stopDrag();
}


 
« Return


©2012 Kroll Design    info@KrollDesign.net    781.910.3694
Last modified: 12/31/1969 7:00 PM