在 GraphicRectangularBorderSkin 中使用动态边框指标时抛出错误 #1502(脚本运行时间太长)
我有一个皮肤,其基础类是 GraphicRectangularBorderSkin (来自 degrafa)。我用它作为面板皮肤。我正在使用 Degrafa 3.2、Flex 3.2。它每次都会抛出 #1502 错误(当脚本运行太长时间时抛出)。如果我删除更改 em 变量的行,错误就会消失。
该类基本上是(尽管为了清楚起见我进行了解释):
<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.EdgeMetrics;
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>
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.EdgeMetrics;
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以显然你需要使用 GraphicPanelSkin 作为基类,它会为你处理 borderMetrics 。
此处的文档:http://www.degrafa.org/docs/com /degrafa/skins/GraphicPanelSkin.html
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