all groups > flash actionscript > january 2006 >
You're in the

flash actionscript

group:

How to CREATE an XML file



Re: How to CREATE an XML file David Stiller
1/23/2006 3:36:26 PM
flash actionscript: Popeye,

[quoted text, click to view]

When Flash loads XML dynamically, the result is very much like what
happens when a browser loads HTML: an object is created in memory, and this
object reflects the structure of the text document from which it was read.
This is why, for example, an HTML page may be altered -- such as for a
rollover image swap -- via JavaScript. JavaScript manipulates the "virtual"
document (the document object model, or DOM) in memory, and the changes are
reflected on the screen. JavaScript cannot save this "mental image" it has
of the HTML document ... once a new page is loaded, the object is replaced.
Same goes for Flash. Once an XML document is loaded, all those nodes become
child objects of an XML object (an instance of ActionScript's XML class),
and while this object can be manipulated in memory by ActionScript, any
resultant changes are lost when the object is deleted. Flash cannot save an
in-memory XML object to a "real" text-based file. When people want to do
this, they use server-side scripting (often PHP or ASP, etc.) to receive the
SWF's XML object and write a text file that way.


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

How to CREATE an XML file Popeye the Sailorman
1/23/2006 8:29:42 PM
I am using XMLConnector to read from an XML file. This works OK. Now I like to
change the contents of the XML file directly from flash (not via PHP). How can
I do that? Is there a tutorial for this somewhere?

Thanks!
Re: How to CREATE an XML file Popeye the Sailorman
1/23/2006 8:46:52 PM
Re: How to CREATE an XML file The Accuser
2/4/2006 2:55:23 PM
Flash makes it very confusing though because the XMLConnector appears as
if it should write XML, what with the param schema and all. The
documentation also makes it sound like you can write XML.

I had the same problem. If you use local file objects to write your XML
and XMLConnector to read them, it all works just fine. All you need is
to trigger the XMLConnector periodically to look for updates.

AddThis Social Bookmark Button