Hi, Robert -
I've had good luck working with the structure outlined below:
var _contentHolder:MovieClip = new MovieClip();var _externalSWF:Object = new Object();function loadAsset(assetURL, onAssetLoad):void {//var assetLoader:Loader=new Loader;var request:URLRequest=new URLRequest(assetURL);//assetLoader.load(request);assetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onAssetLoad);}
function initializeContentHolder(event:Event):void {//var loaderInfo:LoaderInfo = event.target as LoaderInfo;_contentHolder.addChild(event.target.content);_externalSWF = loaderInfo.content;}loadAsset("externalSWF.swf", initializeContentHolder);
Using this approach, I target _contentHolder for any display activity (scale, rotation, etc.), and _externalSWF for any data (variables, MCs, etc.).
function initializeContentHolder(event:Event):void {//var loaderInfo:LoaderInfo = event.target as LoaderInfo;_contentHolder.addChild(event.target.content);_externalSWF = loaderInfo.content;}loadAsset("externalSWF.swf", initializeContentHolder);
Using this approach, I target _contentHolder for any display activity (scale, rotation, etc.), and _externalSWF for any data (variables, MCs, etc.).
I hope this helps.
Bert
On Aug 25, 2008, at 11:56 PM, comeexplorecanada wrote:
Hi,
I am trying to add a TextField to a load external swf. Does anyone
know how to do this in AS3? Here is what I have tried (of course it
doesn't work):
private function addPage():void {
var request:URLRequest = new URLRequest("page1.swf" );
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
var txt_0:TextField = new TextField();
txt_0.text = "Sample Text";
loader.addChild(txt_0);
}
Also in the future I would like to control the timeline of an loaded
external swf. Anyone know what it takes to be able to do this?
Robert S.
Robert Fraher
Candidate for M.F.A. in Interactive Design
University of Minnesota