Copy link to clipboard
Copied
this seems like a basic question but if I have an swf file in the same directory as the fla, and want to have it on an mc, is there a simple way? so I pull an movieclip on the screen and want it to load. anyone have a quick example?
use the loader class to load an external swf.
var loader:Loader=new Loader();
loader.load(new URLRequest("yourexternalswf.swf"));
addChild(loader); // adds the loader to the current timeline
// if you want to add the loader to a movieclip, apply the addChild method to that movieclip, eg:
yourmovieclip.addChild(loader);
Copy link to clipboard
Copied
use the loader class to load an external swf.
var loader:Loader=new Loader();
loader.load(new URLRequest("yourexternalswf.swf"));
addChild(loader); // adds the loader to the current timeline
// if you want to add the loader to a movieclip, apply the addChild method to that movieclip, eg:
yourmovieclip.addChild(loader);
Copy link to clipboard
Copied
so would i put this code in the main as3 timeline or in the code of the appeared movieclip?
i put this in the main area like this (in the click of a button function)
function CFbandELEVENbutton(e: MouseEvent): void
{
TweenMax.to(CFbandELEVENevalbox, 0.5, {alpha:1});
CFbandELEVENevalbox.visible=true;
CFbandELEVENevalbox.mouseEnabled=true;
var loader:Loader=new Loader();
loader.load(new URLRequest("eval.swf"));
addChild(loader); // adds the loader to the current timeline
// if you want to add the loader to a movieclip, apply the addChild method to that movieclip, eg:
CFbandELEVENevalbox.addChild(loader);
}
this returns an error
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
Copy link to clipboard
Copied
you wouldn't use both these:
addChild(loader); // adds the loader to the current timeline
CFbandELEVENevalbox.addChild(loader);
either add to the current timeline or some other parent like CFbandELEVENevalbox
and that error is caused because eval.swf is not found in the default directory.