问题
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:
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.
来源:https://stackoverflow.com/questions/7824452/how-to-set-an-as3-application-size-according-to-the-screen-size-for-mobile-devi