Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.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
在flash CS6中播放帧和声音的暂停_Flash_Flash Builder_Flash Cs6 - Fatal编程技术网

在flash CS6中播放帧和声音的暂停

在flash CS6中播放帧和声音的暂停,flash,flash-builder,flash-cs6,Flash,Flash Builder,Flash Cs6,我创建了一个播放和暂停按钮的电影剪辑,这样随着动画的进行, 我可以在那个画面上暂停,然后继续播放。但是,正如卡通人物所说 当我暂停时,声音无法停止。那么,应该怎么做 添加到脚本中,以便再次播放后,声音将从 它停在哪里 每次声音文件不同时,我是否需要更改脚本的“var mySound:Sound=new mySound()”。当您通过调用Sound.play()返回SoundChannel对象来播放声音时。 然后,您可以通过调用SoundChannel.stop()停止声音 Sound.play(

我创建了一个播放和暂停按钮的电影剪辑,这样随着动画的进行, 我可以在那个画面上暂停,然后继续播放。但是,正如卡通人物所说 当我暂停时,声音无法停止。那么,应该怎么做 添加到脚本中,以便再次播放后,声音将从 它停在哪里


每次声音文件不同时,我是否需要更改脚本的“var mySound:Sound=new mySound()”。

当您通过调用
Sound.play()
返回
SoundChannel
对象来播放声音时。
然后,您可以通过调用
SoundChannel.stop()
停止声音

Sound.play()
可以接收一个int参数,告诉
声音
从该毫秒开始播放

而且,
Sound
对象
SoundChannel
有一个
position
属性,告诉您播放了多少声音(以毫秒为单位)

总之,你可以这样做:

private var mySound:Sound = new MySound();
private var mySoundChannel:SoundChannel;
private var latestPosition:int = 0;

public function play():void
{
    mySoundChannel = mySound.play(latestPosition);
}

public function pause():void
{
    latestPosition = mySoundChannel.position;
    mySoundChannel.stop();
}

public function stop():void
{
    latestPosition = 0;
    mySoundChannel.stop();
}

将声音设置为流(在时间轴上)。或者控制声音频道。您可以使用stop()签出时间线控件停止时间线。//“因此”currentFrame()如何实际添加声音频道?@AmyBlankenship如何在可由stop按钮控制的声音时间线上设置stop()。@parele这是AS3暂停按钮停止();暂停.addEventListener(MouseEvent.CLICK,停止播放);函数stopplaying(事件:MouseEvent):void{MovieClip(root).stop();gotoAndStop(2);}`这是AS3播放按钮。`停止();go.addEventListener(MouseEvent.CLICK,开始播放);函数startplaying(Event:MouseEvent):void{MovieClip(root).play();gotoAndStop(1);}`您应该在单击按钮时录制您的声道位置,然后停止声音,然后在恢复时调用
currentSound.play(recordedPosition,1)
以恢复播放。问题是如果你的声音在时间线上,你将很难捕捉到在特定帧播放的所有声音。我还不知道从时间轴中检索声音的方法,以及检索声音通道创建事件的方法。也许有一些。耶..我把声音放在时间线中..这就是为什么我想知道如何在特定帧暂停当前声音,然后在该帧继续声音。。。所以,如何像其他普通的视频播放器一样,我们可以随时停止电影和音乐。。。。