How to set an AS3 application size according to the screen size (for mobile devices)?

淺唱寂寞╮ 提交于 2019-12-02 10:06:34

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/7824452/how-to-set-an-as3-application-size-according-to-the-screen-size-for-mobile-devi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!