views:

79

answers:

1

I have an AS2 swf file which loads a child swf and would like to pass some structured data to the child. I can pass primitive types by just setting properties on the child MC, but complex types lose their values - i.e.:

in parent:

var testObject = new Object();
testObject.valueName = "value";

child_mc.stringProperty = "test";
child_mc.objectProperty = testObject;

in child:

trace(_root.stringProperty); // traces "test". Hooray!
trace(_root.objectProperty.valueName); // traces "undefined". Boo!

Interestingly if I trace out all the property names of _root.objectProperty using for .. in then the child swf does report that the object has a value called valueName, but the data associated with it is lost in the transition. I've tried using a class rather than an simple object type, and using the indexer syntax for reading/writing the properties, but to no avail.

A: 

Try using a local SharedObject or a LocalConnection object

tarling