Link to home
Start Free TrialLog in
Avatar of flashactions
flashactions

asked on

keyboard event listner/play sound flash cs3

i get an error when trying to make a keyboard event listner play a sound  like so

function detectText(myevent:KeyboardEvent):void {
           if (myevent.keyCode==Keyboard.SPACE) {
                    var mySound:drumloop1 = new drumloop1();
                    DL80194.wav.play();
      }
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, detectText);


then sound is exported for action script already.  Its in the library.  do Ii need to drag the sound to the stage or something?
heres the error i get.  "1120: Access of undefined property DL80194."
Avatar of Imme-emosol
Imme-emosol

You need to split out the problem.

You can do this by chopping it up.

I think the first step would be to try and make the sound work with actionscript.

If you type this in the main line of the script(not in an if or a function or something like that):

DL80194.wav.play();


Does it work?
Or does it still say: "1120: Access of undefined property DL80194."

Maybe try this:
var mySound:Sound = new Sound();
drumloop1.play(DL80194);

I do not know you drumloop1 object//class.

Good luck.
Avatar of flashactions

ASKER

ill try it and ill let you know.  im at work right now answering the 911 lines.  call me if you nedd me.  
drumloop1 is the linkage name.
ASKER CERTIFIED SOLUTION
Avatar of Imme-emosol
Imme-emosol

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial