> 文章列表 > flash播放器手机版(flash播放器)

flash播放器手机版(flash播放器)

flash播放器手机版(flash播放器)

大家好,小杨来为大家解答以上问题,flash播放器手机版,flash播放器很多人还不知道,现在让我们一起来看看吧!

1、  建立 Sound 对象用 load() 方法加载外部的 mp3 来播放;

2、  让 Sound 对象监听 sampleData 事件,这样可以播放由程序动态生成的声音,例如:

3、  下面的示例播放简单的正弦波。

4、  复制代码

5、  代码如下:

6、  var mySound:Sound = new Sound();

7、  function sineWaveGenerator(event:SampleDataEvent):void {

8、  for ( var c:int=0; c<8192; c++ ) {

9、  event.data.writeFloat(Math.sin((Number(c+event.position)/Math.PI/2))*0.25);

10、  event.data.writeFloat(Math.sin((Number(c+event.position)/Math.PI/2))*0.25);

11、  }

12、  }

13、  mySound.addEventListener(Event.SAMPLE_DATA,sineWaveGenerator);

14、  mySound.play();

15、  

本文到此结束,希望对大家有所帮助。