Posts Tagged ‘skin’

製作蘋果電腦的標題列外皮(Mac title bar skin)

Tuesday, May 12th, 2009

Mac的比較漂亮啦 !

剛剛研究出快速畫出Mac標題列的樣式,這麼做:
建立自己的ProgramaticSkin, 覆寫 updateDisplayList( w , h );

override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList( unscaledWidth , unscaledHeight );
var g:Graphics = graphics;
g.clear();

var m:Matrix = verticalGradientMatrix( 0 , 0 , unscaledWidth , unscaledHeight );
drawRoundRect( 0 , 0 , unscaledWidth , unscaledHeight , { tl:6,tr:6,bl:0,br:0 } ,
          [ 0xC5C5C5 , 0x969696 ] , [1,1] ,m , GradientType.LINEAR , [0,255] );

}

關於 Skin 的 Style Chain

Tuesday, April 29th, 2008

今天不願具名的魔人說了個關鍵的技巧, 速記其銘言以表敬意:
問:

Skin 與 本體Component 如何透過style 來取得數值?

答:

//原始檔: Button.as line 1508 @Flex3 sdk
// ***注意 styleName的型別...是Object !//
var styleableSkin:ISimpleStyleClient = newSkin as ISimpleStyleClient;
styleableSkin.styleName = this;

加上

ProgrammaticSkin#getStyle(styleProp:String"):*
//原始檔 ( ProgrammaticSkin.as line 517 @Flex3 sdk)
public function getStyle(styleProp:String):*
{
        return _styleName.getStyle(styleProp);
}