actionscript 3 - AS3: How to resize an External Loaded SWF? -


i'm trying import external swf using code below:

var r:urlrequest = new urlrequest("movie.swf"); var imageloader:loader = new loader();   imageloader.contentloaderinfo.addeventlistener(event.complete, onloadcomplete);  imageloader.load(r); addchild(imageloader);  function onloadcomplete(e:event):void {     imageloader.width  = 100;     imageloader.height = 75;  } 

when trying resize, external movie disappears. wrong?

try event.init instead. things available in event.complete , in other, despite fact order of occurrence fixed, suggest possible in later one, that's not case.

as per comment, dug out old link explaining matter.

a similar event event.complete event.init triggered when external asset ready used, whether downloaded or not. example, few frames of external swf might ready display before entire file downloaded, might want these frames while want rest of movie download. on other hand, files might fully downloaded not yet initialized initialization might take second or two after completion of download process of file, might want wait file ready usage before attempting use asset.

i know what documentation of init event says:

the init event precedes complete event.

so should available in event fired last, right? according experience that's not case. time , time again changing 1 event other solved problem similar 1 given in question.

the first link state this, relevant question:

event.init commonly used when attempting retrieve width , height of image when finishes loaded. such property not available instantly when file finishes loading, attempting retrieve these properties using event.complete fails, event.init must used instead.