问题
So I've got an Android/IOS Air app built in Flash CS6 (NOT using Starling or Stage3D). In the .fla, the stage size is set to 640x1024.
Now i noticed that the stage resolution does not matter that much in air for android because it looks at the display of the phone/tablet. and the adjusts it/
The problem i encounter is that my Samsung galaxy S2 performs better then my brand new oneplus one probably because the oneplus one has a way bigger resolution 1920x1080
Now with the upcoming phones starting to overkill and go up to 4K displays i was wondering if it is possible to upscale the resolution or force an max resolution. I rather have less detail in resolution and have a smooth game then a laggy game because it is forced to details you cannot see with the bare eye.
回答1:
you could use something like
private static function handleResize() :void {
var deviceSize:Rectangle = new Rectangle(0, 0, stage.stageWidth,
stage.stageHeight);
// adjust the gui to fit the new device resolution
}
stage.addEventListener(Event.RESIZE, handleResize);
// call handleResize to initialize the first time
handleResize();
// Then set quality value
if(stage.stageHeight>200 && stage.stageHeight<380){myImageQualitySwitchVar=1}
if(stage.stageHeight>380 && stage.stageHeight<680){myImageQualitySwitchVar=2}
if(stage.stageHeight>800){myImageQualitySwitchVar=3}
and inside your MC's you want to load image quality you want, I would created something for your image loaders like
if(myImageQualitySwitchVar==1){Image01.load(new URLRequest("LowQualityIMG.jpg"));}
if(myImageQualitySwitchVar==2){Image01.load(new URLRequest("MediumQualityIMG.jpg"));}
if(myImageQualitySwitchVar==3){Image01.load(new URLRequest("HighQualityIMG.jpg"));}
Its alot of work doing it this way but the only alternative I can think of is to just create different builds for different devices. ie. 4 builds, a phone build for devices using SDk x.x and under and phones above SDk x.x get different build. and another 2 builds for specific tablets above and below SDK x.x.
hope this helps.
来源:https://stackoverflow.com/questions/26315515/air-flash-mobile-as3-lowering-resolution-or-upscaling-for-performance