Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 添加stop();对于时间轴上的一个电影剪辑,会导致所述电影剪辑中的二人组无法播放,电影剪辑只会跳到结尾_Actionscript 3_Flash_Actionscript_Flash Cs5 - Fatal编程技术网

Actionscript 3 添加stop();对于时间轴上的一个电影剪辑,会导致所述电影剪辑中的二人组无法播放,电影剪辑只会跳到结尾

Actionscript 3 添加stop();对于时间轴上的一个电影剪辑,会导致所述电影剪辑中的二人组无法播放,电影剪辑只会跳到结尾,actionscript-3,flash,actionscript,flash-cs5,Actionscript 3,Flash,Actionscript,Flash Cs5,我有一个由3个独立符号组成的电影唇。其中2个符号的阿尔法粗花呢超过60帧。其中1个符号根本不是粗花呢。所有符号都在单独的层中,第四个空层在actionscript的第60帧上有一个关键帧 第60帧上的actionscript只是“stop();” 我正在从document类向stage动态添加movieclip的一个实例。当我有“stop();”时,movieclip出现在舞台上并直接跳到第60帧,在那里它成功地停止了 如果没有“stop();”,movieclip可以完美地播放alpha tw

我有一个由3个独立符号组成的电影唇。其中2个符号的阿尔法粗花呢超过60帧。其中1个符号根本不是粗花呢。所有符号都在单独的层中,第四个空层在actionscript的第60帧上有一个关键帧

第60帧上的actionscript只是“stop();”

我正在从document类向stage动态添加movieclip的一个实例。当我有“stop();”时,movieclip出现在舞台上并直接跳到第60帧,在那里它成功地停止了

如果没有“stop();”,movieclip可以完美地播放alpha tweens,但显然是连续循环

手动分派Event.COMPLETE并侦听它也不起作用,我还是不希望这样做

以下是将电影剪辑添加到舞台的代码:

//initialize the gameplay, remove title screen.
    private function initialize_gameplay():void
    {

        //remove the title screen
        initialize_title_screen(true);

        this.screen_transition_obj  = new tide_out_video();         
        this.addChild(this.screen_transition_obj);

        this.game_board = new tidepool_gameboard();

        this.screen_transition_obj.addEventListener(Event.COMPLETE,swap_transition_video_for_screen);

    }

    //replace the current transition video with the screen it was transitioning to
    private function swap_transition_video_for_screen(e:Event){

        this.addChild(this.game_board);

        if(this.screen_transition_obj != null){
            if(this.getChildByName(this.screen_transition_obj.name)){
                this.removeChild(this.screen_transition_obj);
            }
            this.screen_transition_obj.removeEventListener(Event.COMPLETE, swap_transition_video_for_screen);
            this.screen_transition_obj = null;
        }




    }
movieclip的类是tidepol\u gameboard,存储对它的引用的文档类的属性是gameboard

知道为什么要放停止()吗是否导致它跳到结尾而不出现粗花呢

更新:
将movieclip立即添加到舞台上,而不是作为事件侦听器正常工作的结果,只有在将movieclip添加到事件列表器中时才会出现问题。

我不敢相信我忽略了这一点,因为我现在觉得这一点相当明显

在问题中发布的代码中,我初始化了this.game_board的一个新实例,然后根据视频剪辑的事件侦听器在延迟后将其添加到后台。动画正在播放,但它是在剪辑添加到舞台之前播放的

感谢您访问回答问题的alecmce

我做了他的Event.ADDED_TO_STAGE Event listener,它成功了,这让我意识到MovieClip不会等到它被添加到STAGE之后才开始播放它自己的时间线,它只是在你实例化对象的那一刻开始

这是新的全功能代码:

    //initialize the gameplay, remove title screen.
    private function initialize_gameplay():void
    {

        //remove the title screen
        initialize_title_screen(true);

        this.screen_transition_obj  = new tide_out_video();
        this.addChild(this.screen_transition_obj);

        this.screen_transition_obj.addEventListener(Event.COMPLETE,swap_transition_video_for_screen);

    }



    //replace the current transition video with the screen it was transitioning to
    private function swap_transition_video_for_screen(e:Event)
    {

        this.game_board = new tidepool_gameboard();
        this.addChild(this.game_board);



        if (this.screen_transition_obj != null)
        {
            if (this.getChildByName(this.screen_transition_obj.name))
            {
                this.removeChild(this.screen_transition_obj);
            }
            this.screen_transition_obj.removeEventListener(Event.COMPLETE, swap_transition_video_for_screen);
            this.screen_transition_obj = null;
        }
    }

您可能需要上传一个小的.fla来重现这个问题。如果没有时间线,与时间线相关的问题很难检查。您可能忽略了时间线中的某些内容,并且没有包含在您的描述中。@xxbbcc我一直试图在一个较小的演示FLA文件中重新创建问题。我似乎无法复制它,但问题仍然存在于完整的文件中。我会上传它,但它是非常大和不方便。。。即使是精简版的演示也是15MB——所有内容都是1080p,并且有几十幅图像构建了这个符号。