Dragging and Constraining
Posted on 30. Mar, 2009 by thornyeternity in ActionScript 3 Snippets
Drag and constrain code:
import flash.geom.*; //or more specifically require ‘Rectangle’
seekBarController_mc.seekBarArrow_mc.startDrag(false, new Rectangle( dragLeft, dragArrowY , dragRight, 0));
//left top right bottom
Beware – startDrag can break very easily in Flash, someone stated will if a text field is in the same container – and that happened to me as well!
—————————
To replace releaseOutside – use stage of object dragged for stop event (Thanks to http://www.webdevils.com/):
drag_mc.stage.removeEventListener( MouseEvent.MOUSE_UP, release_drag);


