ページへ戻る

− Links

 印刷 

Starling+Feathersで9スライスを使う のソース :: NJF Wiki

xpwiki:Starling+Feathersで9スライスを使うのソース

  
特にモバイルなどでは、少しでも画像のメモリを削らないといけないので9スライスやタイルイメージは必須となる。
その使い方。

まずtextureを取得
 var texture:Texture = assets.getTexture(YOUR_9_SLICE_TEXTURE_NAME);
assetsはAssetManager。[[StarlingのAssetManagerを使う]]を参照のこと。

つぎにScale9Texturesを作成する。
 var rect:Rectangle = new Rectangle( 20, 20, 165, 165 );
 var s9texture:Scale9Textures = new Scale9Textures( texture, rect );

ここでrectは9スライスの中心部分を表す長方形。

最後にScale9Imageで表示。高さや幅を指定すると9スライスとしてスケールされる。
 var img9s:Scale9Image = new Scale9Image(s9texture);
 img9s.width = 360;
 img9s.height = 330;
 addChild(img9s);

参考: http://feathersui.com/help/scale9-image.html

  

  • Starling+Feathersで9スライスを使う のバックアップソース(No. All)
    • 現: 2015-05-23 (土) 21:01:29 njf[3]