Flex:无法调整外部加载的 SWF 内容的大小 [英] Flex: Impossible to resize the external loaded SWF's content

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

问题描述

我有一个尝试加载外部 SWF 的应用程序.所以,我们有:

I have an application where I try to load an external SWF. So, we have:

  • 我的应用程序:舞台的尺寸为 768x1280.ScaleMode = EXACT_FIT.
  • 外部 SWF:这是另一个应用程序,其阶段为:800x600.ScaleMode = EXACT_FIT.

问题在于,尽管我应用了scaleX、scaleY"、更改其宽度等,但外部 SWF 并未修改其大小.我还尝试将其插入 Canvas 容器(如如何调整外部 SWF 的大小以适应容器?")但它没有解决我的问题.有趣的一段代码是当我的应用程序加载外部 SWF 时:

The problem is that the external SWF does not modify its size although I apply "scaleX, scaleY", change its width and so on. I also tried to insert it into a Canvas container (as "How to resize an external SWF to fit into a container?" ) but it didn't solve my problem. The interesting piece of code is when the external SWF is loaded by my application:

private function onLoadedApp( evt:Event ):void{ 
     stage.scaleMode = StageScaleMode.EXACT_FIT;    
     trace("Loading Application..");           
     var loaderInfo:LoaderInfo = evt.target as LoaderInfo;    
     loaderInfo.removeEventListener( Event.COMPLETE, onLoadedApp);   
     trace(loaderInfo.loader.content);           
     var swfApplication:SpriteUIComponent = new SpriteUIComponent(evt.target.loader.content );           
     if( SWFContainer.width < swfApplication.explicitWidth ){               
            var coef:Number = SWFContainer.width/swfApplication.explicitWidth;  
            swfApplication.scaleX = coef; 
            swfApplication.scaleY = swfApplication.scaleX;            
      }                
       SWFContainer.addElement(swfApplication);
}

我也尝试通过 SWFLoader 执行此操作,但是尽管我添加了scaleContent"参数,但 external.swf 的内容并没有改变其原始大小.

I also tried to do it through SWFLoader, but the external.swf's content doesn't change its original size although I add the "scaleContent" parameter.

我得到的视觉结果:

外部 SWF 加载到合适的位置,它看起来"有 320x240 的暗淡.但是它的宽度被裁剪了一点,因为如果我拉伸 Flash Player,我就可以看到外部 swf 舞台的其余部分.此外,尽管我缩小/拉伸了 Flash Player,但外部 SWF 永远不会调整大小.它始终保持固定(如果我追踪它的尺寸,我总是得到 800x600,虽然我在视觉上看到的是 320x240)- 如果我增加主应用程序的舞台宽度,这个小剪辑就会消失.

The external SWF is loaded on the suitable position and it "seems" to have 320x240 dim. But its width is a bit cropped, since if I stretch the Flash Player I achieve to see the rest of the external swf's stage. Besides, the external SWF never is resized although I shrink/stretch the Flash Player. It always remains fixed (if I trace its dimensions, I always get 800x600, although I visually see 320x240)- If I increase the stage's width of the main application, this little clip dissapear.

讨论:

我知道原始 Stage 的尺寸为 800,这比我的应用程序的原始 stage (768) 大,但我认为,当我调整大小时,必须将外部 SWF 的 Stage 安装在容器中.它已安装,但未看到外部 SWF 的一部分.就像 Flash Player 记得外部 SWF 舞台的宽度比我的应用程序的宽度大...

I know the original Stage's dimensions are 800, and this is greater than the original stage of my application (768), but I think, when I do the resizing, external SWF's Stage have to be fitted in the container. It is fitted, but a part of the external SWF is not seen. It's like Flash Player remembered that the external SWF Stage's width were greater than my application's one...

提前致谢.

推荐答案

您是否尝试过对外部 SWF"使用缩放效果?

Have you tried to use a scale effect on "External SWF"?

比例效果

这篇关于Flex:无法调整外部加载的 SWF 内容的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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