Control playhead location with sound array
Hey Everyone, Have some old AS2 that I need to transition over to AS3. I am having trouble finding reference on how to convert the array portion of the AS2 code below. We used this to control the playhead so we could bring things onto the screen times to certain parts of our audio. I have gotten my audio playing with the AS3 at the bottom of this message but can't seem to tie it into an array. Any auggestions or things you can point me to?
//AS2
//placed on Frame 1
soundArray = new Array();
soundArray = [8,15,21,27,36];
trace(soundArray);
speech = new Sound(this);
//placed on Frame2
stopAllSounds();
counter = 0;
_root.sndPause = 0;
silent = false;
//set to true onSoundComplete
speech.loadSound("audio/1307_t2_p5.mp3", true);
speech.start();
//playMC.gotoAndStop(2);
speech.onSoundComplete = endLoop;
// This code was placed on Frames where I "held" the playhead until another array point was met
stop();
syncPoint = (soundArray[counter]*1000);
ID = setInterval(this, "isDone", 500);
//////////////////////////////////////////////////////////////////////////////
//AS3
import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
var speech:Sound = new Sound();
speech.addEventListener(Event.COMPLETE, onSoundLoaded);
var req:URLRequest = new URLRequest("audio/993_m2_p6.mp3");
speech.load(req);
function onSoundLoaded(event:Event):void
{
var localSound:Sound = event.target as Sound;
localSound.play();
}
