Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-05-2005, 11:00 AM   #1
jakepeg
flash gurner
 
jakepeg's Avatar
 
Join Date: Apr 2005
Location: carcassonne france / amsterdam
Posts: 219
Send a message via MSN to jakepeg
Default reformating xml on the fly for the tree component

Hi

I want to use the tree component but I have an xml structure that is not formatted in a way the tree component reads xml. Would it be possible (i know anything is possible, I mean possible for me!) to bring the xml into flash, reformat it and then get the tree component to read the reformatted xml?

Any pointers / advice on how to do this would be most appreciated.

I realised that I put this post in the wrong forum - I have put in the components forum now rather than flash mx and lower components forum. Please post replies there and not here.
__________________
www.jakepeg.com

Last edited by jakepeg; 10-06-2005 at 08:28 AM. Reason: wrong forum
jakepeg is offline   Reply With Quote
Old 10-07-2005, 04:57 PM   #2
Lienne
Total Rock Star!
 
Lienne's Avatar
 
Join Date: Aug 2005
Location: California
Posts: 197
Send a message via AIM to Lienne
Default

This took me a long time to figure out. It isn't the whole code (that I use) but I think it will work on it's own. Items between # are variables you need to name yourself.


Code:
function tree_pop() {
	var xml_object:XML = new XML();
		for (i=0; i< #NUMBER OF ITEMS TO ADD# ; i++) {
			current = # REFERENCE POINT (can be number or whatever) #;
			labels = # ITEM TO DISPLAY# ;
			parent = # REFERENCE POINT TO ADD AS A CHILD OF #;

			this[current + "_node"] = xml_object.createElement("node");
			this[current + "_node"].attributes.label = labels;
			this[current + "_node"].attributes.current = current;
			this[current + "_node"].attributes.parent = parent;

			this[parent + "_node"].appendChild(this[current + "_node"]);
	}
	groups_tree.dataProvider = xml_object;
}

If you have any questions, feel free to ask.
Lienne is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:00 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.