Flex拖动

代码如下:

/**
		 * 启用拖拽
		 *
		 * */
		private function enableDrag():void
		{
			var view:SequenceView=this;
			//lockCenter参数不可为true,如为true,mouse up事件将无法捕获;原因不明
			addEventListener(MouseEvent.MOUSE_DOWN, function(event:MouseEvent):void
			{
				view.startDrag();
			});
			addEventListener(MouseEvent.MOUSE_UP, function(event:MouseEvent):void
			{
				view.stopDrag();
			});
			addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void
			{
				view.buttonMode=true;
				view.useHandCursor=true;
			});
			addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void
			{
				view.buttonMode=false;
				view.useHandCursor=false;
			});
		}

 

SequenceView为自定义的继承了UIComponent的控件。

 

你可能感兴趣的:(Flex)