Playing random sounds in a frame
I'm trying to get 1 random sound in a set of 3 sounds to play in this one frame. (Like it will choose randomly to play one out of the 3 sounds).
I have right-clicked my selected frame I have used this code in actions:
__________________________________________
var soundsA:Array=['sound1','sound2','sound3'];
var S=Class(getDefinitionByName(soundsA[Math.floor(3*Math.random())]));
var s=new S();
s.play();
__________________________________________
__________________________________________
But I get these errors:
Symbol 'sprite1', Layer 'actions' Frame 6, Line 4 | 1180: Call to a possibly undefined method getDefinitionByName.
C:\Users\Daniel\Desktop\New folder (2)\gametest.as | 1180: Call to a possibly undefined method addFrameScript.
Symbol 'sprite2', Layer 'Layer 7', Frame 3, Line 1 | 1180: Call to a possibly undefined method gotoAndPlay.
__________________________________________
__________________________________________