【问题标题】:Adding stop(); to a movieclip on the timeline is causing the tweens in said movieclip to not play, the movieclip just skips to the end添加停止();到时间轴上的影片剪辑导致所述影片剪辑中的补间不播放,影片剪辑只是跳到结尾
【发布时间】:2012-05-11 03:50:05
【问题描述】:

我有一个由 3 个独立符号组成的影片剪辑。其中 2 个符号的 alpha 补间超过 60 帧。 1 个符号根本没有补间。所有符号都位于单独的图层中,并且在第 60 帧上有一个带有关键帧的第 4 个空图层,用于操作脚本。

第 60 帧的动作脚本只是“stop();” .

我正在从文档类中动态地将影片剪辑的实例添加到舞台。当我有“stop();”在那里,影片剪辑出现在舞台上并直接跳到第 60 帧,并成功停止。

没有“stop();”在那里,movieclip 完美地播放了 alpha 补间,但显然是连续循环的。

手动调度 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 的类是 tidepool_gameboard,存储对它的引用的文档类的属性是 game_board

知道为什么将 stop(); 放在影片剪辑的第 60 帧会导致它跳到结尾而不进行补间吗?

更新:

立即将影片剪辑添加到舞台而不是作为事件侦听器的结果正常工作,只有在事件侦听器中添加影片剪辑时才会出现问题。

【问题讨论】:

  • 您可能需要上传一个重现此问题的小 .fla。没有时间线就很难检查与时间线相关的问题。时间线可能有问题,您忽略了并且没有包含在您的描述中。
  • @xxbbcc 我一直在尝试在一个较小的演示 FLA 文件中重新创建问题。我似乎无法重现它,但问题仍然存在于完整文件中。我会上传它,但它非常大而且不方便......即使是精简后的演示也是 15MB - 一切都是 1080p 并且有几十张图像构成了这个符号。

标签: actionscript-3 flash actionscript flash-cs5


【解决方案1】:

我不敢相信我忽略了这一点,因为它现在对我来说似乎相当明显。

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

感谢回复this question.alecmce

我做了他的 Event.ADDED_TO_STAGE 事件监听器,它起作用了,这让我意识到 MovieClip 不会等到它被添加到舞台上才开始播放自己的时间线,它只是在你实例化对象的第二秒开始.

这是新的、功能齐全的代码:

    //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;
        }
    }

【讨论】:

    猜你喜欢
    • 2011-08-10
    • 1970-01-01
    • 2019-12-02
    • 1970-01-01
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-23
    相关资源
    最近更新 更多