Loading External SWF, Listening to Dispatched Events

Hi there,

I need to load external SWFs into a main movie. The problem is that I need to listen to dispatched events in the external SWFs in the main movie. How would I go about that?

I am putting together a web application that loads content (external SWFs) dynamically into a main movie container. The external SWFs all have their own functionality and expose certain events to the 'parent'. For example, the user presses a button in the loaded SWF, which needs to trigger an action in the main container.

Hope this makes sense. I'm looking for a short code example or outline and not a complete solution.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dushan De SilvaTechnology ArchitectCommented:
I can give a partial solution for your problem.
Try to load movies to LEVELS. Then it will not overlap your codings. (eg: _root)

BR Dushan
Aneesh ChopraCommented:
You can simply write a function in main movie, which can be called on loaded SWF button press..

suppose main.swf is main movie.. and external.swf is being loaded in a movieclip "container" which is on _root of main.swf

main movie has a function doThis() on _root. and "external.swf" has  a button which call main.swf movies function.
put this code on "external.swf" movie button..
on (release) {

I hope all would be clear


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jsoundAuthor Commented:
Thanks for the suggestion.

My problem is (even with implementing levesl properly) that the main container does not seem to get the triggered events from the loaded SWFs.

For the moment I'm still hunting for a solution.

jsoundAuthor Commented:
I hadn't thought of that, aneeshchopra. I have done this on another project. On this project I had hoped to use the event listener model to get action out of the main movie.

I'll use your suggestion as a backup. Still looking for a solution using event listeners.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.