特にモバイルなどでは、少しでも画像のメモリを削らないといけないので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);
ぺージ情報 | |
---|---|
ぺージ名 : | Starling+Feathersで9スライスを使う |
ページ別名 : | 未設定 |
ページ作成 : | njf |
閲覧可 | |
グループ : | すべての訪問者 |
ユーザー : | すべての訪問者 |
編集可 | |
グループ : | すべての訪問者 |
ユーザー : | すべての訪問者 |
Counter: 1937,
today: 5,
yesterday: 0
初版日時: 2015-05-23 (土) 13:01:29
最終更新: 2015-05-23 (土) 13:01:29 (JST) (3222d) by njf