Using a tree with drag and drop FROM a grid

 

Using the Tree with Drag and Drop Functionality

APPLICATION – SOURCE

Here are some of the things I’m going to run through:

  • 1. A brief description of what the data scriptor is, and how you might use it
  • 2. Walking the Tree
  • 3. LiveDocs DefaultDataDescriptor Documentation
  • 4. Why you would use xml, what you initially get out of it
  • -Heirarchical data structure -children() -the ability to add and subtract nodes easily
  • The following are all great reasources:
  • 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

Page 1 of 2 | Next page