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

后端 未结 1 834
借酒劲吻你
借酒劲吻你 2021-01-26 23:14

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

相关标签:
1条回答
  • 2021-01-27 00:10

    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.

    0 讨论(0)
提交回复
热议问题