¿ªÆô×ó²à

FLASHǶÈëÒôƵÎļþµÄÁ½ÖÖ·½·¨

254969084

2016-2-29 15:05:22

×ÊѶ
±¾ÎĽéÉÜÔÚflashÎĵµÖÐǶÈëÒôƵÎļþµÄÁ½ÖÖ·½·¨£¬Ê¹Æä¿ÉÒÔÔÚFlash playerÖÐÕý³£²¥·Å¡£

¡¡¡¡1¡¢½¨Á¢ Sound ¶ÔÏóÓà load() ·½·¨¼ÓÔØÍⲿµÄ MP3 À´²¥·Å;

¡¡¡¡2¡¢Èà Sound ¶ÔÏó¼àÌý sampleData ʼþ£¬ÕâÑù¿ÉÒÔ²¥·ÅÓɳÌÐò¶¯Ì¬Éú³ÉµÄÉùÒô£¬ÀýÈ磺

¡¡¡¡ÏÂÃæµÄʾÀý²¥·Å¼òµ¥µÄÕýÏÒ²¨¡£

¡¡¡¡ÒÔÏÂÊÇÒýÓÃÆ¬¶Î£º

¡¡¡¡var mySound:Sound = new Sound();

¡¡¡¡function sineWaveGenerator(event:SampleDataEvent):void {

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

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

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

¡¡¡¡ }

¡¡¡¡}

¡¡¡¡mySound.addEventListener(Event.SAMPLE_DATA,sineWaveGenerator);

¡¡¡¡mySound.play();

ÊÕ²Ø
ËÍÔÞ
·ÖÏí

·¢±í»Ø¸´

µÇ¼ºó²ÅÄÜÆÀÂÛ

ÒôƵ·ÖÀà´óÈ«

+ ²é¿´È«²¿·ÖÀà