0

我正在制作一个具有多个框架的电子学习模块。

我想添加一个刷新按钮,以便用户可以重新加载帧(带有影片剪辑),以便他或她可以再次观看。我使用一层放置所有动作。

我尝试了以下方法,但这不起作用

refresh_btn.addEventListener(MouseEvent.MOUSE_DOWN, goToCurrentPageHandler) ;
function goToCurrentPageHandler (event:MouseEvent) : void
{
    SoundMixer.stopAll();
    gotoAndPlay();

我也试过:

/*refresh_button*/  
refresh_btn.addEventListener(MouseEvent.MOUSE_DOWN, goToCurrentPageHandler) ;
function goToCurrentPageHandler (event:MouseEvent) : void
{
    SoundMixer.stopAll();
    gotoAndPlay(currentFrame);

但是当我按下刷新按钮时,它开始播放下一帧。

有人可以帮帮我吗。

谢谢!

4

2 回答 2

1

无需刷新,您可以尝试在播放按钮功能中简单地插入停止按钮功能,然后无需刷新您应该首先停止声音 chaneel sc 以关闭声音 s 。然后通过 //object..mouseEnabled = false 禁用和启用播放和停止按钮;, //object..mouseEnabled = true;

import flash.media.SoundChannel;
import flash.events.MouseEvent;
import flash.events.Event;

btn_play.addEventListener(MouseEvent.CLICK, PlayStream);




var sc: SoundChannel = new SoundChannel();
var s: Sound = new Sound(new URLRequest("folder/song .mp3"));

function PlayStream(event: MouseEvent): void {

sc = s.play();
btn_play.mouseEnabled = false;
btn_stop.mouseEnabled = true;

      btn_stop.addEventListener(MouseEvent.CLICK, StopStream);

          function StopStream(event: MouseEvent): void {
          SoundMixer.stopAll();
          sc.stop();
          s.close();
          btn_play.mouseEnabled = true;
          btn_stop.mouseEnabled = false;
          }

}

stop();
于 2015-10-06T15:43:53.393 回答
0
gotoAndPlay(currentFrame);

实际上播放下一个,因为您是在说“获取当前位置并从那里开始播放”。您的声音在名为 *frame_1* 的影片剪辑中。所以你应该使用:

frame_1.gotoAndPlay(1);

即你的代码应该是这样的:

/*refresh_button*/  
refresh_btn.addEventListener(MouseEvent.MOUSE_DOWN, goToCurrentPageHandler) ;
function goToCurrentPageHandler (event:MouseEvent) : void
{
    SoundMixer.stopAll();
    frame_1.gotoAndPlay(1);
}
于 2013-09-19T06:52:05.070 回答