在舞台上动态放置MovieClip的实例(AS3)

时间:2010-09-10 23:35:14

标签: flash dynamic instance movieclip linkage

我正在尝试动态地将MovieClip的实例放在舞台上。 收到错误:

TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChild()

ActionScript:

         // properties in class ----------
         var circle_ary:Array = new Array;  
         var circ_num:int;//number of circles on the stage

         // dynamically place MovieClip instances on the stage ----------
        // inside Constructor function of class
        var circ_num:int=20;//number of circles on the stage

        for(var i=0; i<circ_num; i++) {
            circle_ary[i] = new Circle(); //linkage in the library
            addChild(Circle[i]);
        }

1 个答案:

答案 0 :(得分:1)

应该是

addChild(circle_ary[i]);