简体   繁体   English

使用loadMovie()(AS2)以root和level0的身份正确地将外部SWF加载到主Flash文件中

[英]Load external SWF correctly to main flash file as root and level0 using loadMovie() (AS2)

First of all sorry about my English. 首先,对我的英语感到抱歉。

I have 2 flash files,one is mine (the main container) and one is a external swf. 我有2个Flash文件,一个是我的(主容器),一个是外部SWF文件。
I want to load the external SWF to my container SWF. 我想将外部SWF加载到我的容器SWF中。
I write this code in my AS2 container, inside the main timeline flash (mine flash). 我将此代码写在主时间轴Flash(我的Flash)内部的AS2容器中。 In the first method, I add a movie clip with instance name mc1 to the first layer: 在第一种方法中,我将实例名称为mc1的影片剪辑添加到第一层:

mc1._lockroot = true;
mc1.loadMovie("external.swf");
countdown = function(){
trace("ok");
}
countdownIt = setInterval(countdown,1000);

This code works fine in most of the cases, but I found many SWFs files that it dosen't work with. 该代码在大多数情况下都能正常工作,但我发现许多SWF文件都无法使用。

These SWFs and work with the following code instead: 这些SWF可以使用以下代码代替:

loadMovieNum("external.swf",0);
countdown = function(){
    trace("ok");
}
countdownIt = setInterval(countdown,1000);

I really try to use that code - BUT !!! 我真的尝试使用该代码-但是! -> if I use this code the external SWF predominant, my main SWF code and all the rest of my code dosen't work (like the setInterval() timer).... ->如果我使用此代码作为外部SWF主体,则我的主SWF代码和所有其他代码均无法正常工作(例如setInterval()计时器)。

I really need help here. 我真的需要这里的帮助。 I want to load the SWF like the second example and still run the setInterval() function. 我想像第二个示例一样加载SWF并仍然运行setInterval()函数。

You are replacing the original SWF when the second parameter to loadMovieNum() is 0. For example, you can see both SWFs when you use this code, and the countdown() function still works. loadMovieNum()的第二个参数为0时,您将替换原始SWF。例如,当您使用此代码时,您可以看到两个SWF,并且countdown()函数仍然有效。

loadMovieNum("external.swf",1);
countdown = function(){
    trace("ok");
}
countdownIt = setInterval(countdown,1000);

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

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