R – How to an AS3 swf hosting an AS2 swf share the same array

actionscriptactionscript-2actionscript-3flashlocalconnection

I have an AS2 swf that has an array that is updated when a user clicks on items on the screen. The array stores the currently selected items. This As2 swf is hosted by an AS3 swf loaded in using Loader class and a local connection between them is managed by swfBridge.

I want to know what the best way for both AS3 and AS2 swfs to share this array is? or how can I call a function in the AS2 (client) swf and return the array to the AS3 (host) swf when it needs to read the items from the array?

Best Answer

you can use local connection, and grant skinner created swfBridge specifically for this purpose:

http://www.gskinner.com/blog/archives/2007/07/swfbridge_easie.html

if you run into any quarks with working with the arrays, I remember strange things like the length being a value in it when doing a for each loop... just a heads up.