This content has been marked as final. Show 6 replies
"Tip: If you know that a control's data provider can always be represented by a specific collection class you can use that class directly, as shown in the preceding example with the ArrayCollection class. However, if your control must be able to handle different types of collections — for example, either an ArrayCollection or an XMLListCollection — you should bind your data provider to a property of type ICollectionView as all collection classes implement the ICollectionView interface, as shown in the following snippet:"
That might help, but it's not an XMLListCollection; it's merely an XMLList. I read you can use the XMLListCollection and use an XMLList within it, but I really don't know what would be involved in the leap, if anyone has any suggestions.
I find these boards rather frustrating. Do people not respond because they would only be helpful if you give them money? I am starting to realize that developers/coders are not like artists...I've spent a lot more time learning various arts than many of you have, or will ever spend, learning your 'development' skills...but I wouldn't dream of charging for passing on my knowledge when I have it.
Maybe I've got it all backwards, and should be charging an arm and a leg every time I learn something new...I guess that's one way to be considered serious in this day and age.
No, it is not about money, except that many of us have jobs and can only devote a few hours a week helping others for free. Between 8:00 pm and 9:00 am the next morning does not leave a lot of time for responses. Perhaps you should study patience a bit.
I understand the frustration. Data access in flex has always been somewhat complicated. It looks like you are pretty close. The tree is hierarchical and XML is hierarchical, so they are a very good match. You can make a collection work, but they are list oriented.
First, set the resultFormat="e4x" in the HTTPService call.
Next, in the result handler:
private function bsResultHandler(event:ResultEvent):void
var xmlDp:XML = XML(event.result);
trace(xmlDp.toXMLString()); //to satisfy yourself that your data is as you expect
myTree.dataProvider = xmlDp; //or use an XML varialble like you did with treeData
Post back if you need more direction.
Thanks Tracy. Yes, I find myself getting very frustrated with Flex/ColdFusion, because I SEE how powerful it can be, and I see the things I want it to do in my head, and I feel nothing but millions of miles between the two.
But that's no excuse for publicly venting, and I apologize. I will be much better off as the reference and other books start to ship, as I find trying to traverse the tremendous amount of info disorienting - also not a reason to get frustrated at silence. I actually have the ENTIRE documentation for Flex/CF ready to print at my work, for binding and all, but our fancy IP-enabled copiers aren't up and running yet...
The worst part is I DO get the sense of how this would be very viably accomplished. You use XMLList, XMLListCollection, the Tree, bind it through RPC and the other various required AS imports...use this as the backbone of an XML file that you actually generate on the fly through ColdFusion with proper CFQUERY/CFLOOP/CFOUTPUT and generate an XML file......build a great db (study how to impliment an adjacency model or nested set model) ...error tests and notifations...validation and notifications...listen to the node of the selected tree item value and fire it off to a thumbnail loader which loads dynamically in response to the event...grab the thumbnail and fire it off to an image...shove 100x more images than you'll ever have in there and test...pray a bit...and suddenly, you're on top of the world. You end up with a solid db, administered only by the site owner (me!) and the world is fed static XML files that load into their clients, and free the server load...you update the XML file only programatically when you administer changes to the db, by calling the above CFC as your last step (to create the xml file that loads into the Tree). Hehe...I'll get there, I hope.
Sorry for boring you with that...
I much appreciate your code, I will study it thoroughly. It's often the 10-20 lines of code, not the pages and pages, that save your butt:)
I sincerely apologize for my frustration. I just see so much potential here, and am at a loss to be able to do it...I promised myself I would never borrow another Flash Gallery...I am doing this myself if it takes me till 2008...or 2009...or...
At which point, my brand new website will be totally out of date...:)
No sweat, I should have perhaps ignored the venting, we all do it now and then.
You may already understand this but here are a few observations:
1. Flex is primarily a presentation tier (client) platform. It does not natively do anything on the server, like file or db access.
2. Some middle tier is required, but it can be most anything, CF, PHP, ASP.NET, JSP, JAVA. There are few Adobe examples of connecting with the server because there are so many possibilities. There ARE many examples available, however, but they are sometimes hard to find. I use google a LOT.
3. If you are not a Java or SOAP guru, or don't have one at your command, HTTPService is THE way to go.
4. XML strings are the easiest way to pass data to an from Flex. There are many other ways, but they are all more complicated
5. Except for CF, which has wizards and stuff to help a lot. I do not do CF myself.
Here is a list of Flex resources. It is daunting. As I mentioned, google is still the best place to start.
Flex 2.x Resources
http://www.adobe.com/devnet/flex/ DEVNET - start here!
Flex style Explorer:
One more piece of advice:
Take things one step at a time.
Very much appreciated, Tracy. I'm very glad you mentioned (3) - HTTPService, because out of the reading I've done, it's the only one I can begin to wrap my head around right now. I even uninstalled the free FDS2 because I got too caught up in its potential...but that's a long ways away.
I'm digging deeply into the code the ColdFusion Wizards build for me, it helps...it's what's kept me from trying to get better for several years now - data manipulation and db creation.
I'm starting slowly, but it can't happen fast enough...which brings home your most important point: one step at a time.
Thanks very much for the links, rest assured I will make good use of them over the coming months.
If anyone else is interested, I was, this evening, able to find a chunk of code that does what I need for this part of my project, and now that I have a functional thing sitting in front of me, I'll be able to follow the code. I still want to delve into your code above, but I am just happy to have found this here, too...for now at least - it loads, at runtime, an XML file into the tree. You can strip away the example, but you have to remove the data-bound curly braces in the component itself, which means getting a grasp on what they all are, and hard-coding the values into the component. I just turned it into a component that loads into an accordion, and it works fine:
Now, on the one-step-at-a-time approach, I have to figure out how to read the values it can give me, for example when my leaf says "myimage.jpg" or "This image was taken on my last trip to the Moon" and fire that off via the appropriate listeners. What I guess that means is coming to terms with all the possible values for a property that can happen both in XML and in the type of item being considered, i.e., in this case, an image, and a string of text to be fed to a TextArea.
That's ONE step, but it's a big one:)