Ask a Question related to Macromedia Flash Data Integration, Design and Development.
-
mixey18 #1
dynamic xml creation
How can I make XML dynamically inside tha Flash using AS?
Basicly i need to make structure like these one:
<root>
<item></item>
...
<item></item>
</root>
That's is the code i'm using:
var doc:XML = new XML("<root></root>");
var item:XMLNode = doc.createElement("item");
doc.firstChild.appendChild(item);
trace(doc);
------------
output:
<root><item /></root>
------------
And now the question, how can i add as many as i need item nodes?
please help me, i can't get over it!
mixey18 Guest
-
Dynamic DataGridRow creation
Dear all, I am working with a datagrid populated by an XML via a WebService and I would like to populate my dataGrid dynamicaly (as I browse the... -
dynamic tag creation
Looking for a way to dynamically evaluate a tag from a string. eg: <cfset tmp = '<cfset myRslt = "Hello">'> <cfoutput> #tmp# </cfoutput> ... -
Dynamic content creation
I'm rather a newbie to flex, at the stage of considering it it is worth my time to get to know to it (or maybe laszlo...). I have this question:... -
Dynamic columns creation
Hi. I have a stored procedure that among other things returns a column with values that will be used to compose a temporary table. The number of... -
dynamic object creation
If I have something like this: s="Array" How whould I get something like this: aObject=s.new In "plain" english I am asking if I have a... -
Motion Maker #2
Re: dynamic xml creation
Text nodes are optional to show something is happening.
var doc:XML = new XML("<root></root>");
var item:XMLNode = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 1") )
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 2") )
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 3") )
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 4") )
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 5") )
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 6") )
doc.firstChild.appendChild(item);
trace (doc)
--
Lon Hosford
[url]www.lonhosford.com[/url]
May many happy bits flow your way!
"mixey18" <webforumsuser@macromedia.com> wrote in message
news:dml3ed$d29$1@forums.macromedia.com...
How can I make XML dynamically inside tha Flash using AS?
Basicly i need to make structure like these one:
<root>
<item></item>
...
<item></item>
</root>
That's is the code i'm using:
var doc:XML = new XML("<root></root>");
var item:XMLNode = doc.createElement("item");
doc.firstChild.appendChild(item);
trace(doc);
------------
output:
<root><item /></root>
------------
And now the question, how can i add as many as i need item nodes?
please help me, i can't get over it!
Motion Maker Guest
-
FlashCuriouz #3
Re: dynamic xml creation
This traces undefined for me. What am I missing?
FlashCuriouz Guest
-
Motion Maker #4
Re: dynamic xml creation
Undefined could mean that the var doc is not in scope or never assigned.
1. I created a new Flash Movie in Flash 8. Should work in MX 2004
2. On frame one I pasted the code
var doc:XML = new XML("<root></root>");
var item:XMLNode = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 1") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 2") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 3") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 4") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 5") );
doc.firstChild.appendChild(item);
item = doc.createElement("item");
item.appendChild(doc.createTextNode("Item 6") );
doc.firstChild.appendChild(item);
trace (doc);
3. Control->Test Movie display in output:
<root><item>Item 1</item><item>Item 2</item><item>Item 3</item><item>Item
4</item><item>Item 5</item><item>Item 6</item></root>
You could also do this and get same results:
myXml_str = "<root><item>Item 1</item><item>Item 2</item><item>Item
3</item><item>Item 4</item><item>Item 5</item><item>Item 6</item></root>";
var doc:XML = new XML(myXml_str);
trace (doc);
--
Lon Hosford
[url]www.lonhosford.com[/url]
May many happy bits flow your way!
"FlashCuriouz" <webforumsuser@macromedia.com> wrote in message
news:dnmhpv$ktm$1@forums.macromedia.com...
This traces undefined for me. What am I missing?
Motion Maker Guest



Reply With Quote

