控件拖动的实现

感觉稍稍还算不错的方法:

 

 

import mx.core.UIComponent;

private function appStartMove(event:Event):void
{
	var component:UIComponent=event.currentTarget as UIComponent
	component.startDrag();
}

private function appStopMove(event:Event):void
{
	var component:UIComponent=event.currentTarget as UIComponent
	component.stopDrag();				
}

 

控件:

 

	<mx:Panel width="250"
			  height="200"
			  layout="absolute"
			  x="365"
			  y="10"
			  mouseDown="appStartMove(event)"
			  mouseUp="appStopMove(event)"
			  id="Hello"
			  title="Hello">

	</mx:Panel>

posted @ 2010-09-27 21:30  noevil  阅读(203)  评论(0编辑  收藏  举报