:スケーリングの
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Rectangle;
public class Test extends Sprite
{
private var _initialeStageBounds : Point = new Point;
private var _container : Sprite = new Sprite;
public function Test()
{
_container.graphics.beginFill(0x556699);
_container.graphics.drawRect(0,0,100,100);
addChild(_container);
_initialeStageBounds.x = stage.stageWidth;
_initialeStageBounds.y = stage.stageHeight;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, onStageResize);
}
private function onStageResize(e:Event) : void
{
var ratio : Number = Math.min(1,
stage.stageWidth/_initialeStageBounds.x,
stage.stageHeight/_initialeStageBounds.y);
_container.x = (stage.stageWidth - _container.width)/2;
_container.y = (stage.stageHeight - _container.height)/2;
_container.scaleX = ratio;
_container.scaleY = ratio;
}
}
}
実はその種類は本当に悪いです、あなたは液体デザイン –