问题加载SWF后调整装载机 [英] Problem resizing loader after loading swf

查看:171
本文介绍了问题加载SWF后调整装载机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code加载在纯ActionScript项目的SWF(的Flex Builder 3)

I'm using the following code to load an swf in a pure actionscript project (Flex Builder 3)

_loader = new Loader();

_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, Loader_Complete);
_loader.contentLoaderInfo.addEventListener(Event.INIT, Loader_Init);

var request:URLRequest = new URLRequest("Skins/TestSkin.swf");
_loader.load(request);

this.addChild(_loader);

这工作好,并显示在舞台上的SWF(500x375出于某种原因 - 不知道为什么,TestSkin.swf是一个没有定义的宽度和高度的Flex应用程序)

This works okay and displays the swf on the stage (500x375 for some reason - not sure why, TestSkin.swf is a flex app with no defined width and height)

然而,当我尝试缩放瑞士法郎,使其填充舞台,我有问题。

However, when I try to scale the swf so that it will fill the stage, I have problems.

我曾尝试:

  • 设置_loader.width和_loader.height在我Loader_Complete处理程序
  • 设置_loader.width和_loader.height在我Loader_Init处理程序
  • 设置_loader.content.width和loader.content.height在我Loader_Complete处理程序
  • 设置_loader.content.width和loader.content.height在我Loader_Init处理程序

我曾经在网上看到过的例子,人们说,这些工作他们,但每当我在任一方式设置宽度或高度,根本就没有显示在所有加载的SWF。

I have seen examples online where people say these work for them but whenever I set width or height in any of these ways, the loaded swf is simply not displayed at all.

任何想法可能会导致什么呢?

Any idea what could be causing this?

什么是调整已经加载了Loader对象的SWF正确的方法是什么?

What is the correct way to resize an swf that has been loaded with a Loader object?

推荐答案

我已经找到了解决方法,我现在的问题。

I have found a workaround for my current problem.

我可以添加以下事件处理程序,以我的子SWF:

I can add the following event handler to my sub-swf:

public function AddedToStage():void
{
    this.width = this.stage.width;
    this.height = this.stage.height;
}

和其附加到应用程序的addedToStage事件。

and attach it to the addedToStage event of the application.

不过,我仍想知道如何从父SWF设置子SWF的尺寸 - 有可能是时间,我没有在加载的SWF控制,所以我不能添加此code吧。

However, I would still like to know how to set the dimensions of the sub-swf from the parent swf - there may be times where I don't have control over the loaded swf so I can't add this code to it.

这篇关于问题加载SWF后调整装载机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆