闪存播放头去错了现场,没有解释的原因 [英] Flash Playhead Going to Wrong Scene, No Explainable Cause

查看:117
本文介绍了闪存播放头去错了现场,没有解释的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时不时的Flash做一些不寻常的,即使有一些简单的一个小场景的导航。这个问题是不是去PitOne场景执导的第一个场景是,闪存播放头奇怪的是到达我们的LEVELONE场景。这让我为难,因为我想不出什么可能改变的Flash播放头的路径。

在第一个场景的最后一行我直接告诉Flash去我们的PitOne场景,这意味着,之前即使有所谓的任何其他导航方法,只有这最后一次应被执行。

除此之外,没有EventListeners的加在第一个场景,比一些鼠标点击事件等。然而,由于立即导出Flash影片,我们会立即带来可怕的LEVELONE场景后,我们可以假设这些EventListeners的什么都没有做我们的问题。

我在每个场景设置一个跟踪的方法来跟踪我们的Flash播放头的遭遇。根据跟踪的输出,仅闪光进入第一现场,并在LEVELONE的一幕,让我们直接从第一个场景到LEVELONE场景。这意味着,如果有我的一部分出了问题,这是第一个场景。 但是,什么可能改变我们的场景导航路径的情况下,我只向你描述?如果您有什么它可以是任何可能的想法,请告诉我!感谢您的时间。

其他信息: 也许它可能会帮助,如果我告诉你,每当我回到第一个场景的场景导航code似乎踢,开始工作,因为那时我们被送到了PitOne场景。

我也意识到,如果你像我一样,你要看到真正的code在眼前。这里的显著$ C $下的第一个场景(我们知道,问题是在第一个场景,因为它是这一幕直接启动我们的LEVELONE场景):

 进口flash.events.MouseEvent;
进口flash.geom.Point;
进口对象类型:flash.events.Event;
进口的flash.display.MovieClip;
进口flash.display.Scene;
进口flash.text.TextFormat用于;

停止();


playNewBtn.addEventListener(MouseEvent.CLICK,playNew);
功能playNew(E:的MouseEvent){
    playNewBtn.removeEventListener(MouseEvent.CLICK,playNew);
    settingsBtn.removeEventListener(MouseEvent.CLICK,gotoSettings);
    creditsBtn.removeEventListener(MouseEvent.CLICK,gotoCredits);
    的gotoAndPlay(1,LEVELONE);
}

settingsBtn.addEventListener(MouseEvent.CLICK,gotoSettings);
功能gotoSettings(E:的MouseEvent){
    playNewBtn.removeEventListener(MouseEvent.CLICK,playNew);
    settingsBtn.removeEventListener(MouseEvent.CLICK,gotoSettings);
    creditsBtn.removeEventListener(MouseEvent.CLICK,gotoCredits);
    的gotoAndPlay(1,设置);
}

creditsBtn.addEventListener(MouseEvent.CLICK,gotoCredits);
功能gotoCredits(E:的MouseEvent){
    playNewBtn.removeEventListener(MouseEvent.CLICK,playNew);
    settingsBtn.removeEventListener(MouseEvent.CLICK,gotoSettings);
    creditsBtn.removeEventListener(MouseEvent.CLICK,gotoCredits);
    的gotoAndPlay(1,积分);
}


的gotoAndPlay(1,PitOne);
 

解决方案

它看起来像你扔命令场景加载之前。不管你怎么努力,(通过添加一个监听至极检查是否加载场景)的flash播放器将留在现场1第1帧,直到现场pitOne被加载。 这就是为什么一个好的做法是创建一个preloader,以确保你所有你需要扔命令在时间线中去的地方之前加载正确。你有简单,很好地解释了样品在这里: HTTP:// WWW .republicof code.com /教程/闪光灯/ AS3 preloader / 。 你另一种解决方案是,当你导出的电影设置场景pitOne在第一个位置

Every now and then Flash does something unusual, even with something as simple as a little scene navigation. The problem is that instead of going to the "PitOne" scene as directed on the first scene, the Flash playhead oddly enough arrives on our "LevelOne" scene. This puzzles me, because I can't figure out what could possibly alter the path of the Flash playhead.

On the last line of the first scene I directly tell Flash to go to our "PitOne" Scene, which means that even if there are any other navigation methods called before, only this last one should be executed.

Besides this, there are no eventListeners added on the first scene, other than some mouse click events. However, since immediately after exporting the Flash movie we are immediately brought to the dreaded "LevelOne" scene, we can assume that these eventListeners have nothing to do with our problem.

I set a trace method on each scene to track the encounters of our Flash playhead. According to the traced output, Flash only enters the first scene and the "LevelOne" scene, so we go directly from the first scene to the "LevelOne" scene. This means that if there is a problem on my part, it's on the first Scene. But what could possibly alter our scene navigation path in the scenario I've just described to you? If you have any possible ideas of what it could be, please tell me! Thank you for your time.

Additional Info: Perhaps it might help if I tell you that whenever I return to the first scene the scene navigation code seems to kick in and starts working, because then we are sent to the "PitOne" scene.

I also realize that if you're like me, you'll want to see the real code at hand. Here's the significant code for the first scene (we know that the problem is on the first scene because it's this scene that launches us directly to the "LevelOne" scene):

import flash.events.MouseEvent;
import flash.geom.Point;
import flash.events.Event;
import flash.display.MovieClip;
import flash.display.Scene;
import flash.text.TextFormat;

stop();


playNewBtn.addEventListener(MouseEvent.CLICK,playNew);
function playNew(e:MouseEvent){
    playNewBtn.removeEventListener(MouseEvent.CLICK,playNew);
    settingsBtn.removeEventListener(MouseEvent.CLICK,gotoSettings);
    creditsBtn.removeEventListener(MouseEvent.CLICK,gotoCredits);
    gotoAndPlay(1,"LevelOne");
}

settingsBtn.addEventListener(MouseEvent.CLICK,gotoSettings);
function gotoSettings(e:MouseEvent){
    playNewBtn.removeEventListener(MouseEvent.CLICK,playNew);
    settingsBtn.removeEventListener(MouseEvent.CLICK,gotoSettings);
    creditsBtn.removeEventListener(MouseEvent.CLICK,gotoCredits);
    gotoAndPlay(1,"Settings");
}

creditsBtn.addEventListener(MouseEvent.CLICK,gotoCredits);
function gotoCredits(e:MouseEvent){
    playNewBtn.removeEventListener(MouseEvent.CLICK,playNew);
    settingsBtn.removeEventListener(MouseEvent.CLICK,gotoSettings);
    creditsBtn.removeEventListener(MouseEvent.CLICK,gotoCredits);
    gotoAndPlay(1,"Credits");
}


gotoAndPlay(1,"PitOne");

解决方案

it looks like you throw the command before scene is loaded. Whatever you try, (by adding a listener wich check if scene is loaded) the flash player will stay at scene 1 frame 1 until scene "pitOne" is loaded. That's why a good practice is to create a preloader to insure you all you need is correctly loaded before throwing command to go somewhere in the timeline. You have simple and well explained sample here : http://www.republicofcode.com/tutorials/flash/as3preloader/. Another solution for you is to set your scene "pitOne" at first position when you export your movie

这篇关于闪存播放头去错了现场,没有解释的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆