如何根据屏幕尺寸(移动设备)设置一个AS3应用大小? [英] How to set an AS3 application size according to the screen size (for mobile devices)?

查看:229
本文介绍了如何根据屏幕尺寸(移动设备)设置一个AS3应用大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个应用程序AS3使用Flash Builder 4.5(不是一个Flex之一)。我的应用可以根据stageWidth / stageHeight自动设置其图形组件。我的问题是与实际的应用程序的大小。如果我没有在SWF meta标签指定宽度/高度,我的应用程序是根据默认的编译(550x400?)。如果我做指定(例如800×480),我将不能够正确支持其他决议。

I am developing an AS3 application (not a Flex one) using Flash Builder 4.5. My application can set its graphical components automatically according to stageWidth/stageHeight. My problem is with the actual application size. If I do not specify width/height in the SWF meta tag, my application is compiled according to the default (550x400?). If I do specify (for example 800x480), I won't be able to support other resolutions correctly.

有没有办法告诉编译器根据设备/舞台的大小,以查看应用程序的大小?

Is there a way to tell the compiler to see the application size according to the device's/stage's sizes?

推荐答案

如果你希望你的应用程序,根据浏览器的大小改变的尺寸,你需要做的一些事情:

If you want the dimensions of your app to change according to the browser's size, you need to do a number of things:

  1. 设置SWF到100%的宽度和高度,在HTML嵌入code

  1. Set the width and height of the SWF to 100% in the HTML embed code

既然你要处理的应用程序自己的布局,你还需要设置比例属性为noScale (仍处于嵌入code)

Since you are going to handle the layout of the app yourself, you also need to set the scale property to noscale (still in the embed code)

在FLASH中的在Stage.scaleMode =noScale的情况然后用 stage.stageWidth stage.stageHeight 来让浏览器窗口的大小和布局您的应用程序。

In Flash set stage.scaleMode = "noScale" then use stage.stageWidth and stage.stageHeight to get the size of the browser's window, and to layout your application.

最后,考虑听Stage.RESIZE更新布局时,浏览器窗口的变化。

Finally, consider listening to Stage.RESIZE to update the layout when the browser's window changes.

所有这将适用于一个常规浏览器,以及在移动电话中运行的Flash应用程序

All this would apply to a regular browser as well as a Flash app running in a mobile phone.

这篇关于如何根据屏幕尺寸(移动设备)设置一个AS3应用大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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