【问题标题】:Error #2025: ActionScript problems with programing错误 #2025:ActionScript 编程问题
【发布时间】:2013-11-21 02:17:29
【问题描述】:

问题是每次我尝试继续下一个场景的背景故事 它不会删除孩子。我想这样做,这样当柜台转到 4 将其取出并放入新场景。有没有办法解决这个问题?不明白怎么切换场景

我正在创建游戏,但出现此错误:

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

       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;

        }

    }
    }
        }
    }

【问题讨论】:

  • 您能否提供更多信息,说明您在此处所做的确切工作、希望完成的工作、尝试过的工作以及不清楚的地方?这些答案通常不会引起太多关注,因为它们几乎没有解释,因此要解决的问题不清楚。

标签: actionscript-3 flash


【解决方案1】:

下面一行是错误的。

startPage.endStartPage == false;

修复:

startPage.endStartPage = false;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多