android - Does Flash pro automatically adjust my game's resolution for all devices? -
i created game using flash pro , have been testing smartphone , it's size 480x800. set document size in fla file 480x800.
but i'm wondering if app automatically adjust resolution fit other sizes such 1280x720 , 960x640.
if not, how can make automatically adjusts resolution fit size of smartphone as possible without losing 480x800 ratio. expect little bit of empty spaces on side of other smartphones. or guess make background picture little bit "extra" bigger 480x800?
oh , smartphone lg android
no, should yourself. should design game ok on various screens.
//startup of game, initial settings stage, //and getting screen size public function main() { addeventlistener(event.added_to_stage, onadded); } private function onadded(e:event):void { removeeventlistener(event.added_to_stage, onadded); stage.align = stagealign.top_left; stage.scalemode = stagescalemode.no_scale; //width , height trace(stage.stagewidth, stage.stageheight); }
to fit background in screen size:
private function fitbackground(background:bitmap, screenwidth:uint, screenheight:uint):void { var availableratio:number = screenwidth / screenheight; var componentratio:number = background.width / background.height; if (componentratio < availableratio) { background.width = screenwidth; background.height = screenwidth / componentratio } else { background.width = screenheight * componentratio; background.height = screenheight; } background.x = (screenwidth - background.width) >> 1; background.y = (screenheight - background.height) >> 1; } //usage fitbackground(mybackground, stage.stagewidth, stage.stageheight)
Comments
Post a Comment