Hello!
As a part of a CMS I want to link certain Objects to each node in some XML that I load.
Basicly here is the setup
// Step 1
var clip:MovieClip = new MovieClip();
clip.name = "My Clip";
trace("Name:" + clip.name); // out: My Clip
// Step 2
var myXml:XML = <node id='1'><node id='2' /><node id='3'/></node>;
trace("Node id:" + myXml.node[0].@id); // out: 2
// Step 3
myXml.node[0].obj = clip;
trace("Object:" + myXml.node[0].obj);
// Step 4
var obj = myXml.node[0].obj;
trace("Name:" + myXml.node[0].obj.name); // out nothing
trace("Type of:" + typeof obj); // out: xml
trace(myXml.toXMLString());
So clip is casted to a string and inserted as an attribute in myXml, -and the reference to clip is lost.
Is there any way to attach an Object reference to a XML node, in a way that makes it possible to retrieve the object back from the XML instance?
Best regards
Martin