translating flash site text and audio part 2

Step 2:Audio Class

The Audio Library Class,
this is a place to store all the references to the audio files to retrieve them and play them back with the getAudio(id) method. It loads the audio file names and id numbers from an xml file or a database. You then retrieve the audio file by the id. This way all the sounds are loaded so you don't have to wait for each file to load on hovers and whatnot.

package com.chuggington.utils.audio
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class AudioLibrary extends Object
{
public var loc:String;
public var list:Array = [];
private var dir_String=[directory for sound files];
private var xml:XML;
private var audioChannel:SoundChannel = new SoundChannel();
private var playing:Boolean = false;
public function AudioLibrary()
{
}
//PUBLIC METHODS
public function load():void
{
//load audio XML from database
var audioLoadVars:URLVariables = new URLVariables();
audioLoadVars.loc = this.loc;
var audioLoadReq:URLRequest = new URLRequest(_main.php+"translateAudio.php");
audioLoadReq.data = audioLoadVars;
audioLoadReq.method = URLRequestMethod.POST;
var audioLoader:URLLoader = new URLLoader();
//audioLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
audioLoader.load(audioLoadReq);
audioLoader.addEventListener( Event.COMPLETE, vHandle_audioLoader_COMPLETE );
audioLoader.addEventListener( IOErrorEvent.IO_ERROR, vHandle_audioLoader_IO_ERROR );
}
//GETTERS
public function getAudio(id:Number):void
{
for(var i_int=0;i {
if(list[i].id==id)
{
var snd:Sound = list[i].sound;
if(playing==false){
playing=true;
audioChannel = snd.play();
audioChannel.addEventListener(Event.SOUND_COMPLETE, vHandle_audioChannel_COMPLETE);
}
}
}
}
//EVENT LISTENERS
private function vHandle_audioLoader_COMPLETE(e:Event):void
{
xml = XML(e.target.data);
var total:Number = xml.audio.length();
for (var i:Number =0; i {
var id:String = xml.audio[i].attribute("id");
//var desc:String = xml.audio[i].attribute("description");
var file:String = xml.audio[i].attribute("file");
var sound:Sound = new Sound();
sound.addEventListener(IOErrorEvent.IO_ERROR, vHandle_audioLoader_IO_ERROR);
sound.load(new URLRequest(dir+file));
list.push({id:id, desc:desc, file:file, sound:sound});
}
}
private function vHandle_audioChannel_COMPLETE(e:Event):void
{
playing=false;
}
private function vHandle_audioLoader_IO_ERROR(e:Event):void
{
trace("IOError:"+e);
}
}
}

I did use php to convert the database to xml for the sound files and load data from the database, but hopefully if you are at this stage of things that stuff is simple enough to figure out on your own. I hope this is enough to point you in the right direction for a translation solution to flash websites.