playing sound
heya need some help got some sound that i need to be played when qued
i want the sound to be played in 'var moveSound:Array'
Any fixes? or does any know how to solve my problem?
import flash.events.MouseEvent;
addChild(btnPos1U);
btnPos1U.x=btnPos1U.y=0;
var positionA:Array=[[0,0],
[0,stage.stageHeight-btnPos1U.height],
[stage.stageWidth-btnPos1U.width,0],
[stage.stageWidth-btnPos1U.width,stage.stageHeight-btnPos1U.height]];
var moveSound:Array = ["1.wav","2.mp3","3.wav","4.oga"];
var t:Timer=new Timer(2000,0);
t.addEventListener(TimerEvent.TIMER,f);
t.start();
function f(e:TimerEvent):void{
btnPos1U.visible = true;
var nQuadrant = Math.floor(Math.random()* 4); // generates [0..3]
btnPos1U.x=positionA[nQuadrant][0];
btnPos1U.y=positionA[nQuadrant][1];
var sAudioName:String = moveSound[nQuadrant];
// ... and now run the sound fx ...
//btnPos1U.x=Math.floor(Math.random()*(stage.stageWidth-btnPos1U.width));
//btnPos1U.y=Math.floor(Math.random()*(stage.stageHeight-btnPos1U.height));
}
btnPos1U.addEventListener(MouseEvent.CLICK,g)
function g (e:MouseEvent):void
{
btnPos1U.visible = false
}
init();
btnNeg1.addEventListener(MouseEvent.CLICK, EndUnlimited);
btnNeg2.addEventListener(MouseEvent.CLICK, EndUnlimited);
btnNeg3.addEventListener(MouseEvent.CLICK, EndUnlimited);
btnNeg4.addEventListener(MouseEvent.CLICK, EndUnlimited);
btnPos1U.addEventListener(MouseEvent.CLICK, on_press);
function EndUnlimited (e:MouseEvent):void
{
gotoAndStop(102);
t.stop();
}
stop();
