这是我的代码:
public class my_Layout extends LayoutBase
{
public function my_Layout(){
super();
var b:Button = new Button;
b.label="my button"
addChild(b)
}
}
但它显示错误,我的方法addChild未定义,
所以我可以做,谢谢
答案 0 :(得分:0)
private function get_list():List{
var list:List = target.parent.parent.parent.parent as List;
return list;
}
private function get_document():View{
var list:List = get_list();
return list.document as View;
}
var list:List = get_list();
var document:View = get_document();
var b:Button = new Button;
b.label = 'wwwwwwwwwwwwwwwwwwwwww';
document.addElement(b);