特にモバイルなどでは、少しでも画像のメモリを削らないといけないので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);
Page Info | |
---|---|
Page Name : | Starling+Feathersで9スライスを使う |
Page aliases : | None |
Page owner : | njf |
Can Read | |
Groups : | All visitors |
Users : | All visitors |
Can Edit | |
Groups : | All visitors |
Users : | All visitors |
Counter: 1181,
today: 1,
yesterday: 0
Princeps date: 2015-05-23 (Sat) 13:01:29
Last-modified: 2015-05-23 (Sat) 13:01:29 (JST) (2071d) by njf