【问题标题】:AS3 Sound, jump forward?AS3 声音,向前跳跃?
【发布时间】:2011-10-20 09:37:27
【问题描述】:

我在 as3 中播放循环声音,有没有办法跳到声音的特定部分,比如在播放过程中 20 秒时,当用户按下 btn 时?

【问题讨论】:

    标签: actionscript-3


    【解决方案1】:

    假设您已经创建了 Sound 和 SoundChannel 对象。

    private var mySound:Sound;
    private var mySoundChannel:SoundChannel;
    
    function onButtonClick(e:MouseEvent):void {
        var pos:Number = 0;
        if ( mySoundChannel ) {
            pos = mySoundChannel.position;
            mySoundChannel.stop();
        }
        //jump ahead 20 seconds, the play accepts time in ms
        mySoundChannel = mySound.play(pos + (20 * 1000));
    }
    

    【讨论】:

      猜你喜欢
      • 2014-10-14
      • 1970-01-01
      • 2016-05-25
      • 2017-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-11
      • 2013-08-02
      相关资源
      最近更新 更多