I'm trying to figure out a nice way to do this, too. Anybody beat us to it? I'll owe you a beer :)
-Josh 2009/3/21 Julien Phalip <lets...@hotmail.com> > Hi, > > I'm using DragManager to drag some objects on the interface. And I'd like > the dragging to be cancelled when the ESCAPE key is pressed. But I can't > find a way to do it since DragManager doesn't seem to have a method for > that. > > Here's what my code looks like: > > private function keyHandler(event:KeyboardEvent):void { > if (DragManager.isDragging && event.keyCode == Keyboard.ESCAPE){ > // TODO: Cancel drag here... > stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyHandler); > } > } > > public function startDrag(event:MouseEvent):void { > ... > DragManager.doDrag(dragInitiator, dragSource, event, image); > stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); > } > > Do you know how I could achieve this? > > Thanks a lot, > > Julien > > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." Josh 'G-Funk' McDonald - j...@joshmcdonald.info - http://twitter.com/sophistifunk - http://flex.joshmcdonald.info/