在 AS2 的 MovieClip 中加载一系列多个 Swf

发布于 2024-08-18 03:33:16 字数 934 浏览 6 评论 0原文

我正在尝试将一系列外部 Swf 加载到舞台上的 Movieclip 中。 swf 的尺寸为 800 x 600,而容器的尺寸为 400 x 400。

每当我尝试将外部 swf 加载到容器中时,容器都会采用加载的 swf 的大小,而不是 400 x 400。我该如何克服这个问题?
我希望加载到容器中的任何 swf 都是 400 x 400

我正在使用以下代码:

        var movLoad:MovieClipLoader = new MovieClipLoader();
        var myListener:Object = new Object();
        myListener.onLoadInit = function(thisMc:MovieClip) {
        thisMc._height = 400;
        thisMc._width = 400;       

        };
        movLoad.addListener(myListener);

        btnNext.onPress = function() 
        {
           loadSwf("myswf_file1.swf");//will change name accordingly.       
        }

        function loadSwf(swf)
       {
           movLoad.loadClip(swf, container_mc);
           // myswf1.swf is a swf which could be of any size .
          // container_mc is movieclip on stage.
         //container_mc has dimension 400 x 400 
        } 

thx 阿米特

Im trying to load series of external Swfs into a Movieclip on stage.
The swf are 800 x 600 in dimension whereas as the container is 400 X 400.

Whenever i try to load the external swf in the container,the container takes the size of the loaded swf instead of 400 x 400 .How can i overcome this?
I want to any swf loaded into the container to be 400 x 400

I'm using the following code :

        var movLoad:MovieClipLoader = new MovieClipLoader();
        var myListener:Object = new Object();
        myListener.onLoadInit = function(thisMc:MovieClip) {
        thisMc._height = 400;
        thisMc._width = 400;       

        };
        movLoad.addListener(myListener);

        btnNext.onPress = function() 
        {
           loadSwf("myswf_file1.swf");//will change name accordingly.       
        }

        function loadSwf(swf)
       {
           movLoad.loadClip(swf, container_mc);
           // myswf1.swf is a swf which could be of any size .
          // container_mc is movieclip on stage.
         //container_mc has dimension 400 x 400 
        } 

thx
amit

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黯然#的苍凉 2024-08-25 03:33:16

编辑(新答案):
我认为问题在于您加载的 swf 保留了先前的 _xscale_yscale 容器_mc 属性。

如果您尝试在container_mc是空剪辑时设置container_mc._width._height,那么Flash(奇怪地)会将其比例更改为零 - 当您的swf加载时,它也会比例为零,因此设置 _width_height 无效。

您可以使用 trace("scale = "+thisMc._xscale+" x "+thisMc._yscale); 进行测试。

修复方法是首先将一些内容放入 container_mc(例如 400x400 的正方形)中。您可以隐藏它,直到您的 swf 加载。

EDIT (new answer):
I think the problem is that your loaded swf retains the previous _xscale and _yscale properties of container_mc.

If you tried to set container_mc._width and ._height when container_mc was an empty clip, then flash (bizarrely) changes it's scale to zero - when your swf loads, it also has zero scale, so setting the _width and _height has no effect.

You could test this with trace("scale = "+thisMc._xscale+" x "+thisMc._yscale);

The fix would be to put something into container_mc (say a 400x400 square) initially. You could hide it until your swf loads.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文