I’m using AS 2.0 and trying to code some logic to:
- Play a random sound clip
- As long as the sound clip is playing, play an animation.
While I’m not an AS programmer, here’s what I have so far
stop();var clipArray = new Array();
var btnChip;
var chipHead;
clipArray[0] = "1_cd.wav";
clipArray[1] = "10_SUB.wav";
clipArray[2] = "2_cmonFrank.wav";
clipArray[3] = "3_ELANOR.wav";
clipArray[4] = "4_factory.wav";
clipArray[5] = "5_FANG.wav";
clipArray[6] = "6_hooty.wav";
clipArray[7] = "7_mqs.wav";
clipArray[8] = "8pb.wav";
clipArray[9] = "9rudys.wav";
//start function
btnChip.onRelease = function(){
gotoAndPlay(2);
chipClip = new Sound();
var randID:Number = Math.floor(Math.random()*9)+1;
chipClip.attachSound(clipArray[randID]);
chipClip.start();
chipClip.AddEventListener(Event.SOUND_COMPLETE, chipDone);
}
function chipDone(ev:Event):void
{
trace("sound over");
this.gotoAndStop(1);
}
The compiler error is complaining at the function chipDone():void line.
Scene=Scene 1, layer=ACTIONS, frame=1, Line 39 The class or interface ‘Event’ could not be loaded.
Something is telling me I need to use AS 3.0…
Thanks in advance…
Doug