Loading External SWF, Listening to Dispatched Events

Posted on 2006-04-11
Last Modified: 2012-05-05
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.


Question by:jsound
    LVL 17

    Expert Comment

    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
    LVL 34

    Accepted Solution

    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


    Author Comment

    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.


    Author Comment

    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.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now