ActionScript 3开始和停止拖动
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3开始和停止拖动相关的知识,希望对你有一定的参考价值。
simple example of startDrag and stopDrag using AS3
package { import flash.display.Sprite; import flash.display.Shape; import flash.events.MouseEvent; public class DisplayList extends Sprite{ private var _rectangle:Sprite; public function DisplayList(){ _rectangle = new Sprite(); _rectangle.graphics.lineStyle(0, 0xFFFFFF, 1); _rectangle.graphics.beginFill(0xFFFFFF, 1); _rectangle.graphics.drawRect(0, 0, 100, 50); addChild(_rectangle); _rectangle.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); _rectangle.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); } private function onMouseDown(event:MouseEvent):void{ _rectangle.startDrag(); } private function onMouseUp(event:MouseEvent):void{ _rectangle.stopDrag(); } } }
以上是关于ActionScript 3开始和停止拖动的主要内容,如果未能解决你的问题,请参考以下文章