FORUMS: list search recent posts

[AS3] Can 2 swfs communicate on the same HTML page?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Clint Milner
[AS3] Can 2 swfs communicate on the same HTML page?
on Apr 23, 2009 at 12:58:34 pm

I've created a crude XML driven mp3 player with visualizer for one of our websites we're working on.
(ignore the songs, they're just on there as an example)

My designers have asked if there's a way to have the player at the top of the page and then have the visualizer as a part of the footer, thus splitting the mp3 player into two seperate swfs on the same page. I don't know how to do it if it's possible, and was wondering if anyone had come across this before.

I think basically it'd be the Sound and SoundChannel I'd need to get from the main swf and pass to the visualizer swf.

Right now I'm not looking to make it work, but I'm just wondering if you could point me in the right direction and if it's even possible.

Kind Regards,

Adobe CS4 Master Suite
Vista Ultimate 64 SP1
Intel Core i7 920 @ 3.60GHz
NVidia Quadro FX 3700
Matrox RT.X2 LE Capture Card

Return to posts index

Pieter Helsen
Re: [AS3] Can 2 swfs communicate on the same HTML page?
on Apr 23, 2009 at 6:08:59 pm

You'll want to take a look at either LocalConnection and ExternalInterface. They can both be used to serve your purpose.

LocalConnection is specifically designed to allow you to communicate between two SWF files on the same page, ExternalInterface allows you to send function calls from the first swf to the html page (via javascript embedded in the HTML) and then to the second swf.

Adobe recommends the use of ExternalInterface, since LocalConnection tends to be a little buggy.

However, this works well for sending variables from one swf to another, or for calling one function from another, I'm not sure it will work for what you are trying to do, since the Sound spectrum probably needs a sound object in order to work well.

Kind regards,

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved