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

发布于 2024-09-18 07:29:26 字数 734 浏览 5 评论 0原文

我正在尝试将 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]);
        }

I'm trying to dynamically place instances of MovieClip on the stage.
Receiving an error:

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]);
        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我爱人 2024-09-25 07:29:26

应该是

addChild(circle_ary[i]);

It should be

addChild(circle_ary[i]);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文