PDA

View Full Version : Flash CS3 swf <-> Flex 2 swf communication



alg
July 29th, 2007, 11:24 PM
I'm starting a new project that is quite heavy on forms, but also requires a fair bit of animation... My current plan is to build the framework for the site in Flash CS3/AS3 and pull in the pages as external swfs. All fairly easy so far...

I've tried loading a swf generated in Flex (just a simple form), this is fine - but I'm stumped as to how I would go about calling a method within flex swf or vice versa. I need to pass some data to the form.

Even localConnection (which seems like a terrible hack for avm2-avm2 communication) returns a statusEvent error when I call the localConnection connect/send on the creationComplete event in my MXML document.

Anyone have any ideas, it can't be this difficult surely!

Al

NaughtyPine
July 30th, 2007, 11:33 PM
can you pass the data out and then back in using javascript?

alg
July 31st, 2007, 07:13 AM
hmm - I'm sure thats possible. But within the instance of the flash player, seems a bit long winded (and will prevent complex data-types and references being passed about).

I'm thinking that if I set the applicationDomain the same for each swf and then create a static class/singleton as a proxy between each that should work. I'll let you know how I get on.

Cheers

thor918
July 31st, 2007, 09:53 AM
have you checked out
http://labs.adobe.com/wiki/index.php..._for_Flash_CS3
http://labs.adobe.com/wiki/index.php...ework:FABridge
?

the flex component kit enables you to communicate between flex and flash!
and the fabridge enables you to communicate with javascript. it all works pretty good. You can even pass javascript arrays over to flex.
In my setup now, I pass data to flex, that passes data furter to flash.

alg
July 31st, 2007, 08:44 PM
Thanks for the links thor918

I've looked into the Flex Componenent Kit for Flash AS3, however this is used to create Flex Components in Flash - does work very well.

I'll look into the AJAX bridge, but again I feel their must be a simpler way - as my base Flash SWF has loaded the Flex SWF in as child...

I'll keep on...

Cheers

andrewfitz
August 1st, 2007, 04:07 PM
http://www.gskinner.com/blog/archives/2007/07/swfbridge_easie.html

thor918
August 2nd, 2007, 05:02 AM
Deleted