I have a skin that's base clas is GraphicRectangularBorderSkin (from degrafa). I'm using it as a panel skin. I'm using Degrafa 3.2, Flex 3.2. It throws a #1502 error (thrown when a script runs too long) every time. If I remove the line changing the em variable, the error goes away.
The class is basically (although I paraphrased for the sake of clarity):
<GraphicRectangularBorderSkin xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://www.degrafa.com/2007>
<geometry>
<GeometryComposition>
<RegularRectangle width="{skinWidth}" height="{skinHeight}">
<fill>
<SolidFill color="#00ff00" />
</fill>
</RegularRectangle>
</geometry>
<mx:Script>
<![CDATA[
import mx.core.EdgeMet开发者_开发问答rics;
private var em:EdgeMetrics = new EdgeMetrics(0, 0, 0, 1);
private var headerHeight:Number = 0;
public override function styleChanged(styleProp:String):void{
headerHeight = getStyle("headerHeight");
em = new EdgeMetrics(0, headerHeight, 0, 1);// if i remove this line, the error goes away
}
public override function get borderMetrics():EdgeMetrics{
return em;
}
]]>
</mx:Script>
</GraphicRectangularBorderSkin>
So apparently you need to use GraphicPanelSkin as the base class and it'll take care of the borderMetrics for you.
Documentation here: http://www.degrafa.org/docs/com/degrafa/skins/GraphicPanelSkin.html
精彩评论