如何根据屏幕尺寸(针对移动设备)设置AS3应用程序尺寸?
我正在使用 Flash Builder 4.5 开发一个 AS3 应用程序(不是 Flex 应用程序)。我的应用程序可以根据 stageWidth/stageHeight 自动设置其图形组件。我的问题是实际的应用程序大小。如果我没有在 SWF 元标记中指定宽度/高度,我的应用程序将根据默认值(550x400?)进行编译。如果我指定(例如 800x480),我将无法正确支持其他分辨率。
有没有办法告诉编译器根据设备/阶段的大小查看应用程序的大小?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望应用程序的尺寸根据浏览器的大小进行更改,则需要执行以下操作:
由于您要自己处理应用的布局,因此还需要将
scale
属性设置为noscale
(仍在嵌入代码中)在 Flash 中设置
stage.scaleMode = "noScale"
然后使用stage.stageWidth
和stage.stageHeight
获取浏览器窗口的大小,并布局您的最后,考虑监听 Stage.RESIZE 以在浏览器窗口更改时更新布局。
所有这些都适用于常规浏览器以及手机中运行的 Flash 应用程序。
If you want the dimensions of your app to change according to the browser's size, you need to do a number of things:
Set the width and height of the SWF to 100% in the HTML embed code
Since you are going to handle the layout of the app yourself, you also need to set the
scale
property tonoscale
(still in the embed code)In Flash set
stage.scaleMode = "noScale"
then usestage.stageWidth
andstage.stageHeight
to get the size of the browser's window, and to layout your application.Finally, consider listening to Stage.RESIZE to update the layout when the browser's window changes.
All this would apply to a regular browser as well as a Flash app running in a mobile phone.