存档

文章标签 ‘DragManager’

使用DragManager后引发的卡死

2010年1月17日 评论已被关闭

今天在使用DragManager时,放下后程序卡的要命,经过好几个小时的检查的排查,原来是被拖的图像组件中有很多少找不到的路径,后来把这些找不到的路径直接设置为’’空字符串,问题终于解决了,好郁闷啊。

分类: Flex 标签:

Flex中的拖放操作的反馈指示符

2009年12月11日 评论已被关闭

今天稍微仔细地看了一下DragManager类,发现有些东西以前还没有用过呢。。。。

COPYimage

LINKimage

MOVEimage

分类: Flex 标签:

用Flex把文字拖到文本输入框

2008年5月16日 评论已被关闭

懒人总是不喜欢敲键盘-_-
试着拖动文本到输入框中看看,拖动过程中时,拖动到输入框下面可以消除输入中原来的文字。



源代码:



import com.hexagonstar.util.debug.Debug;
import flash.events.MouseEvent;
import mx.controls.Image;
import mx.controls.Label;
import mx.controls.TextInput;
import mx.core.DragSource;
import mx.events.DragEvent;
import mx.managers.dragClasses.DragProxy
import mx.managers.DragManager;
[Embed("0.jpg")]
[Bindable]
private var img:Class;
private function dragIt (event:MouseEvent):void {
var dragIntor:* = event.currentTarget
Debug.trace (dragIntor)
var newla:Label = new Label ();
newla.text = dragIntor.text;

var ds:DragSource = new DragSource ();
ds.addData (dragIntor.text,"mydata");
DragManager.doDrag(dragIntor,ds,event,newla)
}
private function dragEnter (e:DragEvent):void {
var te:*= e.currentTarget as TextInput;
if (e.dragSource.hasFormat ('mydata')) {
//te.text = "a";
te.setStyle ("borderColor", 0xffff00);
//te.setStyle ("borderThickness", "10");
DragManager.acceptDragDrop (te);
}
}
private function dragExit (e:DragEvent):void {
var te:*= e.currentTarget as TextInput;
te.text = "";
}
private function dragDrop (e:DragEvent):void {
var te:*= e.currentTarget as TextInput;
te.text += e.dragSource.dataForFormat ("mydata") as String;
te.setStyle ("borderColor", null);
}
//
]]>



分类: 生活杂谈 标签: ,

Flex中drag and drop(拖拽)相关教程

2008年5月5日 评论已被关闭
分类: 生活杂谈 标签: ,

Flex中自定义鼠标拖拽

2008年3月10日 评论已被关闭

Flex中自定义鼠标拖拽

把左边的方块拖到右边相同颜色的方块上看看吧:

分类: 未分类 标签: ,

在Tree组件中使用拖放及拖动GridData中的数据

2007年9月15日 评论已被关闭

原文地址:http://axel.cfwebtools.com/index.cfm/2007/9/7/Using-a-tree-with-drag-and-drop-FROM-a-grid

使用Tree的拖放功能

APPLICATION - SOURCE

开始之前要完成以下事情:

  • 1. 原始数据的简短描述,怎么样使用它
  • 2. 传到Tree
  • 3. 帮助文档中的DefaultDataDescriptor(默认数据描述符)
  • 4. 为什么你愿意使用XML,从中获得什么-层级数据结构
    -children()子项
    - 简单的添加和删除节点功能

以下是最好的学习资源:

  • 5. Peter Ent – Tree Control DataProviders
  • 6. Peter Ent – Tree Drag and Drop Part 1
  • 7. Peter Ent – Tree Drag and Drop Part 2
  • 8. Flexcoders group – topic > "Am I within the folder or outside the folder?"
  • 9. Adobe Quickstart – Working with the tree
  • 10. Spring Loaded Folders: (Jason Hawryluk)

A brief description of what the data scriptor is, and how you might use it

The data descriptor is something that some might say is misnamed. Because this little class, does so much MORE than describe data. You can use it to drill down into the node you choose, say… the selectedItem of your tree… myTree.dataDescriptor.isBranch(myTree.selectedItem)… I don’t think I fully understood the dataDescriptor until I read "Walking the tree" which is a great, great recursive function.

Why you would use xml, what you initially get out of it

XML in actionscript 3.0 has some great built in functions like childen(), parent(), appendChild(), prependChild(), attributes()… among many many others, along with the e4x functions that comply with the ECMA Script standard, that allow you to filter data, and find things very very easily.

XML also already is heirarchichal by nature… so it only makes sense to use it in a tree structure, because it works very naturally with the tree because of it’s heirarchical nature.

One of the reasons I like the ArrayCollection vs. XMLListCollection is because an array collection can contain other ArrayCollections, and the XMLListCollection cannot. The XMLListCollection can contain XMLLists, but NOT multiple collections… so your limited by this, in the sense, that you can only have one filterFunction per XMLListCollection, as for an ArrayCollection you can have many if you embed array collections… I have never gotten this to work recursively, but theoretically, you could have a filter function filter a tree, and even dive into the nodes… (i’ve gotten it to work one level deep, into the tree’s branches, but never to go deeper, i do think i’m close, but no cigar)

I’ve been trying to work on this, but just havent had the time lately. eventually i’m gonna get it! and that will be a great day!.

A lot of people (including myself) that arent familiar with the dataDescriptor will use xml functions to recurse through the tree data, please… NOTE… YOU DONT HAVE TO DO THIS! the dataDescriptor is AWESOME! use it… i havent had it fail me yet…

Peter Ent has some great blogs on tree usage

Tree Control DataProviders > has information about finding and updating nodes, in both using xml dataproviders and arraycollections. Tree Drag and Drop Part 1 & Tree Drag and Drop Part 2 both have great info, but i did not seem to find any files with the whole source files released…

Flexcoders group – topic > "Am I within the folder or outside the folder?"

I can’t seem to thank this person named "Precia" for posting this code… it’s fantastic… THANK YOU THANK YOU THANK YOU! wish they had a blog they posted a link to.

Adobe Quickstart – Working with the tree

This tutorial entry is absolutely fantastic for beginners, and it’s also a fantastic refresher for intermediate or advanced developers… I remember finding this back when i started researching the tree many projects ago… and using this entry as my starting and ending point, it explained everything i needed to do… I didnt event pay attention, but now i realize they even use the dataDescriptor in the code they’ve posted. But they don’t really focus on it as much as they should in my opinion.

Spring Loaded Folders

I found this by looking up the Error #1009: Cannot access a property or method of a null object error while dragging and dropping with a tree… I absolutely love this post, and believe Jason did a terrific job of explaining the tree, and extending it as well. One thing I wanted to mention, that i’m sure he has found out since his post, is the following:

He states that when dragging and dropping with a tree, you can’t drop within a folder unless that folder is expanded, which is not necessarily true… you can do that, it takes a little bit of maneuvering but it can be done, take a look at the adobe quick start that i’ve linked to for using the tree.

I make use of the Spring Loaded Folder, and the flexcoders code that was posted, please take a look at the application i’ve linked to at the top and at the bottom of the page…

It’s getting super late, i’m writing this at 2am in a text file, and i’ll post it some time tomorrow, after i create the project and publish the source on the server at work…

Spring Loaded Folders: (Jason.Hawryluk@3gcomm.fr)

Peter Ent Tree Control DataProviders

Tree Drag and Drop Part 1

Tree Drag and Drop Part 2

Precia (app.developer) yahoo groups (am I within the folder or outside the folder?

Walking the tree

Working with the tree adobe quickstart

LiveDocs DefaultDataDescriptor Documentation

drag and drop info flex docs 1:

drag and drop info flex docs 2:

APPLICATION - SOURCE

分类: 未分类 标签: , ,