PDA

View Full Version : Load AS2 swf, pass it root variable



xMetal
November 26th, 2007, 01:49 PM
Hello all,

I am creating an AS3 program, but unfortunately I need to load some legacy SWF files that I can't alter. These old files are dynamic charts, and each one is fed an XML file with it's data.

The original implementation had these chart files on HTML pages, and each one was given it's datafile URL on the query string, like so:

<PARAM NAME=movie VALUE="FC2MSColumn.swf?dataUrl=../ChartXML/ideationbyage.xml">

My problem is that I now need to load these same SWF files into my AS3 program, and somehow feed it this _root variable in the same way it would have gotten them in the original HTML implementation. I'm kind of stumped on how to accomplish this though.

Any pointer or tips would be greatly appreciated!

paularmstrong
November 26th, 2007, 02:00 PM
As far as I know, you can't play AS2 files in AS3 swfs or vice versa.

pigiuz
November 26th, 2007, 02:43 PM
yes, you can :D

you have to use LocalConnection class to let as2 and as3 files communicate each other.
to get the variable you only have to look at loaderInfo object (here's a post i found about http://www.metah.ch/blog/2007/07/04/passing-variable-from-javascript-to-as3-flash-cs3/)

paularmstrong
November 26th, 2007, 07:17 PM
Hm... that's news to me... I thought LocalConnection only allowed them to talk together, not to actually load one swf into another swf.

xMetal
November 27th, 2007, 09:03 AM
Well, the AS2 SWF loads just fine in my program, I can confirm that. Of course it doesn't DO anything, because it can't find it's datafile.

I'l look into local connection further, but I was under the impression from reading the docs on that that I'd need to alter the original AS2 files to build in that method, but unfortunately I don't have access to the source files.

In my case I don't need to GET the variable, I need to set it, just as if I'd loaded that old SWF on an webpage and gave it a query string variable.

Guro
February 15th, 2008, 09:49 PM
i have exactly same problem :( but can't solve, anyone can help?