简体   繁体   English

Flash / AS3:加载带有动画的外部SWF *

[英]Flash / AS3: Load external swf *with animation*

i load three external swf files into my flash movie, here's the code: 我将三个外部SWF文件加载到Flash电影中,代码如下:

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? 我的三个虚拟SWF文件都可以正常工作,但是当我尝试加载使用某种动画(例如补间动画)的SWF文件时,SWF不再显示了。 ? thank you! 谢谢!

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. 好吧,我无法正确理解您的问题。。但是,我会建议您一想,将stop()放在要加载的所有三个swf上。 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... 尝试这个...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM