flash actionscript:
Popeye,
[quoted text, click to view] > 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?
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."