在VBox上设置特定的角半径

jas*_*son 0 apache-flex flex3 actionscript-3

默认情况下,如果cornerRadius在VBox上设置,则将影响所有四个角.如何仅将cornerRadius应用于左下角和右下角?

Vai*_*hav 5

扩展VBox组件并覆盖updateDisplayList方法,如下所述: -

override protected function updateDisplayList(unscaledWidth:Number, 
       unscaledHeight:Number):void 
{

   super.updateDisplayList(unscaledWidth, unscaledHeight);

   var cornerRadius:Number = getStyle("cornerRadius");
   var backgroundColor:int = getStyle("backgroundColor");
   var backgroundAlpha:Number = getStyle("backgroundAlpha");
   graphics.clear();

   // Background
   drawRoundRect(0, 0, unscaledWidth, unscaledHeight, 
       {tl: 0, tr: 0, bl: cornerRadius, br: cornerRadius}, 
       backgroundColor, backgroundAlpha);


}
Run Code Online (Sandbox Code Playgroud)