Flash/FlashBuilderでAirforAndroid/プログラミングメモ
提供: 初心者エンジニアの簡易メモ
Sprite設置方法
赤い円が左上に出るはず
views/_SampleView.mxml
<?xml version="1.0" encoding="utf-8"?> <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="ホーム" creationComplete="_init()"> <fx:Declarations> <!-- 非ビジュアルエレメント (サービス、値オブジェクトなど) をここに配置 --> </fx:Declarations> <fx:Script source="_SampleView.as" /> <s:Group id="sp1" width="480" height="520"/> </s:View>
views/_SampleView.as
import flash.display.Sprite;
import mx.core.UIComponent;
private function _init():void {
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFF0000);
circle.graphics.drawCircle(0, 0, 20);
var c:UIComponent = new UIComponent();
c.addChild(circle);
sp1.addElement(c);
}
