開発環境
Adobe AIR 3.6
Starling Framework 1.3
Feathers 1.0

package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Rectangle;
import starling.core.Starling;
import starling.utils.HAlign;
import starling.utils.RectangleUtil;
import starling.utils.VAlign;
[SWF(width="640",height="960",frameRate="60",backgroundColor="#0")]
public class TestiOS extends Sprite
{
public static const STAGE_WIDTH:uint = 640;
public static const STAGE_HEIGHT:uint = 960;
private var viewport:Rectangle;
public function TestiOS()
{
super();
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
addEventListener(Event.ADDED_TO_STAGE,addedToStageHandler);
}
protected function addedToStageHandler(event:flash.events.Event):void
{
removeEventListener(Event.ADDED_TO_STAGE,addedToStageHandler);
viewport = RectangleUtil.fit(
new Rectangle(0,0,stage.stageWidth,stage.stageHeight),
new Rectangle(0,0,stage.fullScreenWidth,stage.fullScreenHeight),
starling.utils.ScaleMode.SHOW_ALL);
Starling.handleLostContext = true;
Starling.multitouchEnabled = true;
var st:Starling = new Starling(Main, stage, viewport);
st.stage.stageWidth = STAGE_WIDTH;
st.stage.stageHeight = STAGE_HEIGHT;
st.start();
st.showStatsAt(HAlign.RIGHT,VAlign.BOTTOM,1);
}
}
}
Main.as
package
{
import starling.display.Quad;
import starling.display.Sprite;
import starling.events.Event;
import starling.utils.Color;
public class Main extends Sprite
{
public function Main()
{
super();
addEventListener(Event.ADDED_TO_STAGE,addedToStageHandler);
}
private function addedToStageHandler(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE,addedToStageHandler);
var quad:Quad = new Quad(100,100,Color.BLUE);
quad.x = (stage.stageWidth >> 1) - (quad.width >> 1);
quad.y = (stage.stageHeight >> 1) - (quad.height >> 1);
addChild(quad);
}
}
}

