Flexでのリンケージ方法
よくFlashCS3などでライブラリに登録ってする方法のFlex版です。
以下のように書くとSWFに直接埋め込んでくれて、かつクラスとして利用可能です。
[Embed(source='earth.jpg')] private var earth:Class private function init():void{ var btmp:Bitmap = new earth(); }
//テクスチャーの作成 var texture:BitmapData = new BitmapData(512,512); var btmp:Bitmap = new earth(); //←ココ texture.draw(btmp); //ビットマップマテリアル var bit_mat:BitmapMaterial = new BitmapMaterial(texture); var phong_shader:PhongShader = new PhongShader(light ,0xFFFFFF ,0xaaaaaa,100,texture,texture); //球体を作成 this.sphere = new Sphere(new ShadedMaterial(bit_mat,phong_shader),200,16,12); //平面シーンに追加 this.scene.addChild(this.sphere);