`
yunzhongxia
  • 浏览: 651206 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Panel拖动

 
阅读更多

     在flex中Panel等组件不直接支持拖动,为了让Panel等组件支持拖动功能,外面可以监听MouseDown和MoudeUp事件。例如下面的代码就可以实现Panel的拖动了。

 

   

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
	</fx:Declarations>
	<s:Panel title="测试拖动" width="400" height="300" mouseDown="startDrag()" mouseUp="stopDrag()">
		<s:Button label="测试"/>
	</s:Panel>
</s:Application>

 

 

 

备注:"stopDrag()"和"startDrag()" 是Flex本身自带的方法。

 

 

 

 

 

0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics