错误#2025:ActionScript编程问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误#2025:ActionScript编程问题相关的知识,希望对你有一定的参考价值。

问题是,每次我尝试继续下一个场景backStory它不会删除孩子。我想这样做,以便当计数器转到4时它将把它取出并放入一个新的场景。有没有办法解决这个问题?我不明白我怎么能切换场景

我正在创建一个游戏,我收到此错误:

ArgumentError:错误#2025:提供的DisplayObject必须是调用者的子级。在Runner / onEnterFrame()的flash.display :: DisplayObjectContainer / removeChild()

       package  {

        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.display.MovieClip;
        import flash.text.TextField;
        import flash.text.TextFormat;

        public class Runner extends MovieClip {
            public var startPage:StartPage = new StartPage();
            public var backStory1:BackStory1 = new BackStory1();
            public var water:Water = new Water();



            public function Runner() {
                addChild(startPage);
                stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
            }
            function onEnterFrame(event:Event):void{

                if(startPage.endStartPage == true){

                    removeChild(startPage);
                    addChild(backStory1);
                    startPage.endStartPage == false;

                }

                if(backStory1.backStory1End == true){ //in backstory1 the bool backstory1end is suppose to be true but it doesnt get to that point
                    removeChild(backStory1);
                    addChild(water);
                    startPage.endStartPage == false;

                }





                }
            }

        }

背景故事课

    package  {

        import flash.events.Event;
        import flash.events.MouseEvent;
        import flash.events.KeyboardEvent;
        import flash.ui.Keyboard;
        import flash.display.MovieClip;
        import flash.text.TextField;
        import flash.text.TextFormat;

        public class BackStory1 extends MovieClip {

            var backStory1End:Boolean = false;
            var count:int = 0;

            public function BackStory1() {
                backStory1Text.text = "sssherro";

                if (stage)
                {

                    init(null);


                }
                else
                {
                    addEventListener(Event.ADDED_TO_STAGE,init);
                }

                function init(e:Event):void
                {

                    removeEventListener(Event.ADDED_TO_STAGE, init);
                       nextButton.addEventListener(MouseEvent.MOUSE_DOWN,onButtonClick);

            }
            function onButtonClick(event:MouseEvent):void{

                count++;


                if(count == 1){
                    backStory1Text.text = "awesome1";
                    //backStory1End= true;
                }
                else if(count == 2){
                    backStory1Text.text = "awesome2";
                }
                else if(count == 3){
                    backStory1Text.text = "awesome3 leave game press";
                }
                else if(count == 4){
                    //backStory1Text.text = (String)(counter);
                    backStory1End = true;

        }

    }
    }
        }
    }
答案

以下行是错误的。

startPage.endStartPage == false;

固定:

startPage.endStartPage = false;

以上是关于错误#2025:ActionScript编程问题的主要内容,如果未能解决你的问题,请参考以下文章

操作脚本3 - ArgumentError:错误#2025:提供的DisplayObject必须是调用者的子级

错误 MIDL2025:语法错误:需要一个接口

爬坑Python 3.6 在 Socket 编程时出现类型错误 TypeError: a bytes-like object is required, not 'str'(示例代码(代

使用工具提示时出现错误 #2025:提供的 DisplayObject 必须是调用者的子对象

ActionScript / Flash - 以编程方式位图填充 IDE 绘制的矢量?

如何以编程方式将 ActionScript CuePoints 注入 FLV 文件