我想添加一个包含自定义类的对象的UI组件,扩展UI组件,并且我想将这个自定义组件显示到画布上我没有做错误编译或运行时间,但它不显示Uicomponent。当我将UIcomponent添加到画布时没有任何显示?
这里是代码;
var item:RecordRanderer = new RecordRanderer();
item.randerItem(child);
item.x=20;
item.y = 20+ycomponent;
item.width = 90;
item.height = 200;
item.setStyle("backgroundColor","Red");
this.addChild(item);
记录randerer是对自定义类,这也是也是UIComponent的扩展,它包含了一些textinputs等
现在我将它添加到画布上,但没有显示
这里是自定义类
internal class RecordRanderer extends UIComponent
{
//----------------------------------------------------
//Class varibles
private var namelabel:Text = new Text();
private var employname:TextInput = new TextInput();
//----------------------------------------------------
//RecordRanderer class constructor function
public function RecordRanderer()
{
//--------------------------------
this.height = 200;
this.width = 200;
//--------------------------------
//name text box and label
namelabel.text = "Name: ";
namelabel.setStyle("fontSize",12);
namelabel.x = 5;
namelabel.y = 20;
employname.setStyle("borderColor",0xA9C0E7);
employname.setStyle("cornerRadius", 15);
employname.setStyle("borderStyle", "Solid");
employname.x = 100;
employname.y = 20;
}
public function set namevalue(val:String)
{
if(val.length > 0)
{
namelabel.x = 5;
namelabel.y = 10 + Height;
employname.text = val;
employname.x = 100;
employname.y = 10 + Height;
Height += 25;
// contain.addChild(namelabel);
// contain.addChild(employname);
this.addChild(namelabel);
this.addChild(employname);
}//end if
}//end function
我有什么用得到任何事情显示
询问更多细节
感谢名单