2

这是我的代码:

public class my_Layout extends LayoutBase
{
    public function my_Layout(){
        super();
        var b:Button = new Button;
        b.label="my button"
        addChild(b)
    }
}

但它显示错误,我的方法 addChild 未定义,

那我能做什么,谢谢

4

1 回答 1

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);
于 2012-05-07T06:36:06.953 回答