如何根据屏幕尺寸(针对移动设备)设置AS3应用程序尺寸?

发布于 2024-12-10 19:17:00 字数 239 浏览 5 评论 0原文

我正在使用 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 技术交流群。

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

发布评论

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

评论(1

花之痕靓丽 2024-12-17 19:17:00

如果您希望应用程序的尺寸根据浏览器的大小进行更改,则需要执行以下操作:

  1. 中将 SWF 的宽度和高度设置为 100%

  2. 由于您要自己处理应用的布局,因此还需要将 scale 属性设置为 noscale (仍在嵌入代码中)

  3. 在 Flash 中设置 stage.scaleMode = "noScale" 然后使用 stage.stageWidthstage.stageHeight 获取浏览器窗口的大小,并布局您的

  4. 最后,考虑监听 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:

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

  2. 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)

  3. 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.

  4. 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.

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