我正在尝试扩展 Flex 4 中的 TextItem 类,但我不断收到以下错误:
Could not resolve <custom:txtIdNumber> to a component implementation.
我txtIdNumber.as
的如下
package custom {
import spark.components.TextInput;
public class txtIdNumber extends TextInput {
public function txtIdNumber()
{
super();
}
override protected function width():void
{
super.width();
this.width = 100;
}
}
}
我想使用它的模块看起来像这样
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:custom="../custom.*"
layout="absolute" width="100%" height="100%">
<s:BorderContainer width="100%" height="100%" >
<custom:txtIdNumber />
</s:BorderContainer>
</mx:Module>
最初我认为我可能以错误的方式扩展类,但我发现的所有示例看起来都一样。