Send data to Flex 3 application from SWF (version 7)

Does anyone know how to take swf (version 7) and use SwfLoader or something similar to access the root variable in swf from within a Flex application? I have tried many things with no success. I don't want to clutter this post with all my failed attempts, but I'll post them later if I see them needed as examples.

Just some background: I am generating a swf file in .NET and the library used can only generate swfs up to 7. Flex application is built with Flex 3. I need to access variables in swf. I don't care how it's done, as long as I can do it. It doesn't matter if I raise an event, or use a LocalConnection, or access variables directly, I haven't been able to do any of that up to this point. (Swf is loading though ... and showing up in my Flex app).

Oh, and swf is not inline.

+1


source to share


2 answers


ExternalInterface has been available since as1.0, so this might be the solution to your problems. Using the ExternalInterface, ActionScript can interact with javascript and vice versa. So you can pass the variable to the javascript function from swf and pass that javascript function to the same variable to the FLEX function. I don't want to write all the code if it doesn't seem like it might be the answer you are looking for, in which case let me know and I will write out the code for you or just ...



Check this: ExternalInterface

+1


source


When you load a SWF that targets FP8 or earlier, it loads as an AVM1Movie instance. From the docs:

"The AVM1Movie object can use methods and properties inherited from the DisplayObject class (such as x, y, width, etc.). However, the interaction between AVM1Movie and AVM2 objects is incompatible (for example, calling methods or using parameters) objects are allowed."



This is because FlashPlayer 9+ actually has two different virtual machines and they cannot communicate directly with each other.

LocalConnection will definitely work in this scenario: I was using SWF SW7 with a Flex 2 application and had a communication (via method call) working from v7 -> Flex2 and Flex2 -> v7. I would take a look at how you set this up, because it will definitely work.

0


source







All Articles