Loading external swf on timeline

on a certain frame on my timeline, when my movie reaches that frame i want to load an external swf (without having to click anywere, it has to be done automatically). Can someone please let me know the action code on how too do this? Thanks!

Are you using AS3 or AS2? Here is a piece of code in AS3 for loading an external movieClip:


import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;

function startLoad()
{
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest(“External.swf”);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}

function onCompleteHandler(loadEvent:Event)
{
        addChild(loadEvent.currentTarget.content);
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
startLoad();

One simple way is to use startLoad() on that specific frame. (right click on the rectangle => actions, and then paste the code). You can find a more simple code, even in as2. The aproach is the same.

Hi there DesignBox.

What you want to do can be done.

I’ve written an article on my site about how to do just the sort of thing you’re after. Take a look if you like - it will show you the code you need to load an external SWF with ActionScript.

http://fcOnTheWeb.com/articles/external_swfs/

Hope it helps. :slight_smile: