开发者

How can I setup a files that can work for both iphone and ipad?

开发者 https://www.devze.com 2023-03-29 16:48 出处:网络
I usually used as3 in flash to develop game, but I always do for a fixed size of file. But in itunes there are a lot of app work for both ipad - 768x1024 and iphone 640x940 (this size is iphone 4) and

I usually used as3 in flash to develop game, but I always do for a fixed size of file. But in itunes there are a lot of app work for both ipad - 768x1024 and iphone 640x940 (this size is iphone 4) and even different iphone generation has different size too. So how can i use flash to make one app tha开发者_如何学编程t can work for all of these devices?


you want to create your application to target multiscreens. doing so involves a few additional steps, but the overall process is quite straight-forward.

generally, the process involves sizing your stage at start up to be the same size as the screen and then sizing and positioning your display objects at runtime according to the size of the stage, or simply the screen size:

package
{
    import flash.display.Screen;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.geom.Rectangle;    

    [SWF(backgroundColor = "0x555555")]
    public class MultiscreenApplication extends Sprite
    {
        public static var screenBounds:Rectangle = Screen.mainScreen.visibleBounds;

        public function MultiscreenApplication()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            stage.frameRate = 60;

            init();
        }

        private function init():void
        {

        }
    }
}

there are several well-read online resources at Adobe to guide you thru the steps, including Christian Cantrell's Writing multiscreen AIR apps and Authoring mobile Flash content for multiple screen sizes. there was also a webinar during last year's Adobe MAX which you can watch here: Multiscreen Development Techniques with Flex and Adobe AIR

0

精彩评论

暂无评论...
验证码 换一张
取 消