ActionScript 3.0中 - 编码的下一个按钮,但它跳至下一下一页下一页、下一、但它、按钮

2023-09-08 14:59:53 作者:温软少女心

我想创建一个简单的Flash琐碎的网站,每个页面都有一个previous,和下一个按钮。 我的previous和下一个按钮似乎很好地工作,当你点击它们走过的电影。 (即下一步 - >下一步 - >下一步 - >下一个...即preV - > preV-> preV - > ...)

I'm trying to create a simple flash trivial site where each page has a previous, and next button. My previous and next buttons seems to work fine when you click them to walk through the movie. (ie. next-> next-> next -> next... ie. prev->prev-> prev->...)

但是,当我用2个按钮在一起。 最后接下来应该带我回到我cliked 2号旁边的页面,而是它带给我以后的页面。

But when I use the 2 buttons together. The last next should bring me back to the page where I cliked on the 2nd next, but instead it brings me to the page after.

例如: 第1页(pssed下一$ P $) - >第2页(pressed旁边) - > 3页(pressed previous) - >第2页(pressed旁边) - >给我的页4(这应该给我3页)

For example: page 1 (pressed next)-> page 2 (pressed next)-> page 3(pressed previous)-> page 2 (pressed next) -> give me page 4 (It should give me page 3)

下面是我的$ C $下一个网页:

Here is my code for one of the pages:

stop();

previous_button.addEventListener(MouseEvent.MOUSE_DOWN, returnToMarineInvertebrate);
function returnToMarineInvertebrate(event:MouseEvent):void{
    gotoAndStop("MarineInvertebrate");
}

hint_button.addEventListener(MouseEvent.MOUSE_DOWN, goToFishHint);
function goToFishHint(event:MouseEvent):void{
    gotoAndStop("FishHint");
}

next_button.addEventListener(MouseEvent.MOUSE_DOWN, goToFossil);
tail.addEventListener(MouseEvent.MOUSE_DOWN, goToFossil);
function goToFossil(event:MouseEvent):void{
    gotoAndStop("Fossil");
}

我觉得我的逻辑是正确的,但我不知道什么是错的。任何帮助将是AP preciated!谢谢!

I think my logic is correct, but I'm not sure what's wrong. Any help would be appreciated! Thank you!

推荐答案

这是我已经压制住了几次在Flash相当打了小姐的错误。 如果您正在使用停止()目标帧, gotoAndStop(targetFrame)上就会有成败参半

This is a rather hit-and-miss bug in Flash that I've faced down a few times. If you are working with stop() on the target frame, gotoAndStop(targetFrame) will have mixed success.

相反,你会想叫的gotoAndPlay();

这样做的理由是,在某些情况下(不是全部), gotoAndStop()将会导致闪存忽略脚本。该站打来 gotoAndStop()未来可通过一个单一的框架,有时过冲,平时如果停止()已经存在

The reason for this is, in some cases (not all), gotoAndStop() is going to cause Flash to ignore the scripts. That stop call coming from gotoAndStop() can sometimes overshoot by a single frame, usually if stop() is already there.

因此​​,如果您切换到的gotoAndPlay(targetFrame),让你的停止()命令处理制动,你应该罚款。

Thus, if you switch to gotoAndPlay(targetFrame), and let your stop() commands handle braking, you should be fine.