发布时间:2019-08-20 08:01:18编辑:auto阅读(1644)
1,9宫格在UI的缩放中应用的很多.如果你不明白什么是9宫格,请百度 , google
在AS3中设置9宫格, 有2种方式:
我现在讲第一种方式 , 也是最简单的一种方式:
在 Flash软件中:
弹出"元件属性"面板,如下图:
编辑这个元件,你会这个元件多了4条线,没错,调整这4条线就能,就能改正该元件的缩放特征:
在FB/FD中,也就是在AS3代码中的实现,也就是第二种方法:
package com.upupgame.mahjong.player2.game.views.ui.controls.dialogs.huCards{ import flash.display.Sprite; import com.upupgame.mahjong.player2.game.views.ui.GameAssets; import flash.geom.Rectangle; public class HuCardsGridBG extends Sprite { private var m_huBG:Sprite; private var m_allow:Sprite; public function HuCardsGridBG(){ this.m_huBG = (new GameAssets.huPromptBG() as Sprite); this.addChild(this.m_huBG); this.m_allow = (new GameAssets.huArrows() as Sprite); this.addChild(this.m_allow); this.m_allow.y = 5; this.set9GridBGWidth(); } private function set9GridBGWidth():void{ var grid:Rectangle = new Rectangle(20, 25, 60, 50); this.m_huBG.scale9Grid = grid; } public function setBGWidth(_value:int):void{ this.m_huBG.width = (_value + 15); this.m_allow.x = ((this.m_huBG.width - 43) / 2); } } }//package com.upupgame.mahjong.player2.game.views.ui.controls.dialogs.huCards
重点是 : scale9Grid方法的应用.
上一篇: Windows Phone 7 Tips
下一篇: DOM(W3C)
48885
47962
38735
35875
30300
27064
26084
20919
20728
19090
552°
632°
637°
642°
613°
593°
666°
734°
857°
983°