0
votes

i load three external swf files into my flash movie, here's the code:

import flash.display.*

var screens:Array = new Array(
    'screens/left.swf',
    'screens/center.swf',
    'screens/right.swf'
);

var loaders:Array = new Array();

function complete_listener(event:Event):void {
    event.target.content.width  = 341;
    event.target.content.scaleY = event.target.content.scaleX;
}

for (var i=0; i<screens.length; i++) {
    loaders[i] = new Loader();
    loaders[i].contentLoaderInfo.addEventListener(Event.COMPLETE, complete_listener);
    var url:URLRequest = new URLRequest(screens[i]);
    loaders[i].load(url);
    loaders[i].x = 341 * i;
    loaders[i].y = 0;
    addChild(loaders[i]);
}

everything works just fine with my three dummy swf's, but when i try to load an swf file that uses some kind of animation (for example a motion tween), the swf isn't displayed any more... is there a way around this? thank you!

1
Are these animations directly embedded in the loaded SWFs or are they in turn loaded from some other SWF?Amarghosh
They are directly embedded in the loaded SWFs. Actually you can see the first frame (i guess) flash up every few seconds, really strange…Patrick Oscity
May be those animations might be crashing the loaded SWF due to some reason like accessing stage property from constructor (or before they're actually added to stage) - do you have access to the code of those animations? Make sure you're testing on a debug version of Flash player - this way you'll come to know what kind of error/exception is thrownAmarghosh
I think the problem is, that the background color of the stage is not shown when loading an external swf. do i really have to draw a rectangle with the same color in the background of the external swf or is there another way?Patrick Oscity

1 Answers

0
votes

Well I can not understand your problem properly.. But I will advise you one think that put stop() on all three swfs which you are gonna load. Then when they are loaded, you can start your animation then.

function complete_listener(event:Event):void 
{
    event.target.content.width  = 341;
    event.target.content.scaleY = event.target.content.scaleX; 
    var myLoadedSWF:MovieClip =event.target.content as MovieClip;
    myLoadedSWF.play();
}

Try this...