- 浏览: 540514 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
coosummer:
推荐使用http://buttoncssgenerator.c ...
【转载】CSS圆角按钮(一) -
saiarmuluo:
不错,支持。
java log4j日志 写入数据库 -
springdata_springmvc:
spring mvc demo教程源代码下载,地址:http: ...
Freemarker 使用 -
zlbdexiaohao:
棒棒的
flex ToolTip汇总 -
hw_128:
demo的代码的,能不能发一下,谢谢 qq257515270 ...
java log4j日志 写入数据库
flex3 Drag
Drag 常用的方法
1.系统startDrag,stopDrag(适合单个拖拽)
2.Move()(适合多个拖拽)
3.DragManager (有默认的特效)
1.单个拖拽
private function mouseDownHandler():void{ demo.startDrag(); } private function mouseUpHandler():void{ demo.stopDrag(); } <mx:Button id="demo" mouseDown="mouseDownHandler()" mouseUp="mouseUpHandler()" />
2.拖拽区域限制
private function mouseDownHandler():void{ demo.startDrag(false,new Rectangle(0,0,can1.width-demo.width,can1.height-demo.height)); }
3.拖拽多个原理:把需要拖拽的对象放入一个 容器中拖拽这个容器
private function mouseDownHandler():void{ cv2.startDrag(); } private function mouseUpHandler():void{ cv2.stopDrag(); } <mx:Canvas id="cv1" width="544" height="324" backgroundColor="#FFFFFF"> <mx:Canvas id="cv2" x="0" y="39" width="197" height="159" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="green" buttonMode="true" mouseDown="mouseDownHandler()" mouseUp="mouseUpHandler()"> <mx:Button id="demo" label="demo" x="10" y="38"/> <mx:Button label="demo" x="76" y="60"/> <mx:Button label="demo" x="28" y="90"/> </mx:Canvas> </mx:Canvas>
4.拖拽多个控制拖拽区域(容器中x轴最小,最大的元素,y轴最大最小的元素)
<mx:Script> <![CDATA[ import mx.core.UIComponent; import mx.events.MoveEvent; private var maxXObj:Number; private var minXObj:Number; private var maxYObj:Number; private var minYObj:Number; private var tempArrayX:Array; private var tempArrayY:Array; private function mouseDownHandler():void{ this.cv2.startDrag(); tempArrayX=new Array(cv2.numChildren); tempArrayY=new Array(cv2.numChildren); for(var i:int;i<cv2.numChildren;i++) { var child:UIComponent= cv2.getChildAt(i) as UIComponent; tempArrayX[i]=child.x; tempArrayY[i]=child.y; } tempArrayX.sort(Array.NUMERIC); tempArrayY.sort(Array.NUMERIC); maxXObj=tempArrayX[tempArrayX.length-1]; minXObj=tempArrayX[0]; maxYObj=tempArrayY[tempArrayY.length-1]; minYObj=tempArrayY[0]; this.addEventListener(MouseEvent.MOUSE_MOVE,moveHandler); } private function mouseUpHandler():void{ this.removeEventListener(MouseEvent.MOUSE_MOVE,moveHandler); if(cv2.x<(0-minXObj))//最左边 { this.cv2.x =(0-minXObj); } var temp1:Number=cv2.width-(maxXObj+demo.width); if(cv2.x>=this.width-(cv2.width-temp1))//最上面 { cv2.x=this.width-(cv2.width-temp1); } if(this.cv2.y <= (0-minYObj)){ this.cv2.y = (0-minYObj); } var temp2:Number=cv2.height-(maxYObj+demo.height); if(this.cv2.y >=this.height-(cv2.height-temp2)){//最上面 cv2.y=this.height-(cv2.height-temp2); } this.cv2.stopDrag(); } private function moveHandler(event:MouseEvent):void{ if(cv2.x<(0-minXObj))//最左边 { this.cv2.x =(0-minXObj); this.cv2.stopDrag(); } var temp1:Number=cv2.width-(maxXObj+demo.width); if(cv2.x>=this.width-(cv2.width-temp1))//最上面 { cv2.x=this.width-(cv2.width-temp1); this.cv2.stopDrag(); } if(this.cv2.y <= (0-minYObj)){//最上面 this.cv2.y = (0-minYObj); this.cv2.stopDrag(); } var temp2:Number=cv2.height-(maxYObj+demo.height); if(this.cv2.y >=this.height-(cv2.height-temp2)){//最下面 cv2.y=this.height-(cv2.height-temp2); this.cv2.stopDrag(); } } ]]> </mx:Script> <mx:Canvas id="cv2" x="0" y="39" width="197" height="159" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="green" buttonMode="true" mouseDown="mouseDownHandler()" mouseUp="mouseUpHandler()"> <mx:Button id="demo" label="demo" x="10" y="38"/> <mx:Button label="demo" x="76" y="60"/> <mx:Button label="demo" x="28" y="90"/> </mx:Canvas>
5.Move()方法控制
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.core.UIComponent; private var regX:Number; private var regY:Number; public var closeButton : UIComponent; protected function startDragging(event : MouseEvent) : void { regX = event.stageX - demo.x; regY = event.stageY - demo.y; systemManager.addEventListener( MouseEvent.MOUSE_MOVE, systemManager_mouseMoveHandler, true); systemManager.addEventListener( MouseEvent.MOUSE_UP, systemManager_mouseUpHandler, true); systemManager.stage.addEventListener( Event.MOUSE_LEAVE, stage_mouseLeaveHandler); } protected function stopDragging() : void { systemManager.removeEventListener( MouseEvent.MOUSE_MOVE, systemManager_mouseMoveHandler, true); systemManager.removeEventListener( MouseEvent.MOUSE_UP, systemManager_mouseUpHandler, true); /* systemManager.stage.removeEventListener( Event.MOUSE_LEAVE, stage_mouseLeaveHandler); */ regX = NaN; regY = NaN; } /** * @private */ private function titleBar_mouseDownHandler(event:MouseEvent) : void { startDragging(event); } var tempx:Number; var tempy:Number; private function systemManager_mouseMoveHandler(event:MouseEvent) : void { event.stopImmediatePropagation(); tempx=event.stageX - regX; tempy=event.stageY - regY; if(tempx<0) { tempx=0; } if(tempx>this.width-demo.width) { tempx=this.width-demo.width; } if(tempy<0) { tempy=0; } if(tempy>this.height-demo.height) { tempy=this.height-demo.height; } demo.move(tempx,tempy); } private function systemManager_mouseUpHandler(event:MouseEvent) : void { if (!isNaN(regX)) stopDragging(); } private function stage_mouseLeaveHandler(event:Event) : void { if (!isNaN(regX)) stopDragging(); } ]]> </mx:Script> <mx:HBox id="demo" backgroundColor="green" mouseDown="{titleBar_mouseDownHandler(event)}" width="141" height="147" x="282" y="156"> </mx:HBox> </mx:Application>
6.使用DragManager拖拽
DragManager参考连接:
http://demojava.iteye.com/blog/1183448
发表评论
-
Flex4 模块 [转载]
2012-11-05 09:30 0使用flex4模块(1):传递数据到模块 在主程序与模块 ... -
Flex4 List改变了dataProvider,怎么锁定选中Item【转载】
2012-11-05 09:29 1025sfList.dataProvider = sfData; i ... -
解决flex嵌入字体导致文件过大的问题[转载]
2012-11-05 09:25 0众所周知,Flex嵌入字体 ... -
flex DataGrid 行列颜色设置
2012-05-06 20:00 9098群里一哥们问了个问题,就写了个这个demo DataGrid ... -
flex4 Spark DataGrid,title的字体居中
2012-03-20 21:23 6225【原创】flex4 Spark DataGrid,title的 ... -
flex4 Application backgroundImage
2012-03-10 15:13 2819群里一哥们问我 f4 设置 Application 的 bac ... -
flex 无法将“<mx:>”解析为组件执行.解决办法:
2012-03-09 16:34 8241flex项目导入早期版本 无法将“<mx:******& ... -
flex component 去掉点击加亮边框
2012-03-09 16:35 1039群里有人问我怎么去掉TextInput的文本框加亮。写下来 ... -
flex ProgressBar skin 修改
2012-03-09 16:36 2858f3的形式修改border: 其中 barSkin 是外边框 ... -
flex Draggable Flex Components
2012-03-08 20:38 924Creating Resizable and Draggabl ... -
flex 3d云标签
2012-03-08 20:37 1502来自:http://downloads.wordpress.o ... -
AS html 形式超链接设置
2012-03-08 20:36 1607lbl.htmlText = " <b& ... -
flex IViewCursor 的应用
2012-03-08 20:35 1048IViewCursor 的应用 demo 效果图:可以上下 ... -
f4 spark 占位控件
2012-03-08 20:33 924halo的占位控件。<mx:Spacer width=& ... -
halo的grid DataGridColumn itemRenderer 混用 spark 组件
2012-03-03 14:20 1375halo的grid DataGridColumn itemRe ... -
flex DeferredInstanceFromFunction 使用
2012-03-02 21:54 1548flex DeferredInstanceFromFuncti ... -
flex ContextMenuItem 根据状态隐藏选项
2012-02-27 18:28 1351因群里一个群员的要求,写了这个demo,代码粗糙,根据一个控件 ... -
动态设置itemRenderer
2012-02-18 19:34 0<mx:TileList id="tl&quo ... -
【转】解决RemoteClass alias信息丢失
2012-02-18 19:15 756问题发生场景:flex程序中存在多个module都调用一个标记 ... -
flex tree icon
2012-02-14 19:53 32291.tree 改变每一项的 icon图标 <?xml ...
相关推荐
flex 练习拖拽的例子,很简单,可以了解一下原理
Flex3组件拖放教程,该组件是flex组件中最有特色的
flex支持拖拽的DataGrid,如果去查api来置一些属性将会比较麻烦,这个DataGrid可以获取拖拽的内容,这是一个application,可以直接运行
Flex 3 实现的拖放示例,很简单,可以移植到自己的程序中,Web形式和AIR形式都可以使用。
介绍Flex 拖拽的事件机制和用法。
flex实现窗口的拖拽,最大化,最小化,关闭。
Introduction ...Chapter 9 Flex Video Gallery with Drag-and-Drop Chapter 10 Exploring Flex Charting Chapter 11 Creating Forms: The “Will Flex for Food” Registration Page Chapter 12 Flex and AIR
flex中一个很不错的拖拉伸缩组件,适合新人学习的组件....
处理list-based控件的拖放事件 13 运行在AIR中的Flex应用程序的拖放 16 拖放实例 17 例子1:用Canvas作为drop target 17 例子2:指定drag proxy 18 例子3:为drop target处理dragOver和dragExit事件 ...
flex漂亮MP3播放器源码,结合flash、CSS等制作精美皮肤…… 具有一般的mp3播放、声音调节、进度条、3种频谱显示方式,内带flash素材源文件…… Drag.as通用拖动源代码…… Visualization Explorer……
Amethyst is a fully-featured Visual ... Amethyst supports the drag-and-drop design, editing and debugging of Flex and AIR applications and it can also load Flash IDE projects for editing and debugging.
一个关于flex中,拖拉拽的控件实例,源码也是摘录的,自己多参谋下大师之作,最后面咱自己写项目,帮助很大
使用本地拖拽(Drag-and-Drop)API 23.11节.与操作系统剪贴板交互 23.12节.添加HTML内容 23.13节.在ActionScript和JavaScript之间跨脚本操作 23.14节.本地SQL数据库 23.15节.检测和监控网络连接 23.16节.检测用户是否...
1. a book Developing Flex Applications 2. a web page viewer for doc88 ebt 3. a DDA downloader for doc88.com CONTENTS PART I: Presenting Flex CHAPTER 1: Introducing Flex. . . . . . . . . . . . . . ...
FlexLayout FlexLayout是一个布局管理器,用于将React组件布置在多个选项卡集中,可以调整和移动选项卡的大小。现在使用尝试FlexLayout唯一的依赖关系是React。 特征: 分离器标签标签拖动和排序拖动选项卡集(一次...
提供: Flex中图片组件的拖放实现实例源码 后续还有 表格数据 等组件的拖放实例
http://files.riacodes.com/flex_drag-drop-gift-cart/demo/ 示範地址
flex 对图片的一些操作,loader ,drag
某控件在某一固定大小的区域内的拖拽以及拉伸
- FIX: When the curve contain more then one figure and they were all unconfined and curve have alternative brush then whole flex-object bounding rectangle was filed. - FIX: The MaskColor property ...