• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

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."
0
flashactions
Asked:
flashactions
  • 2
  • 2
1 Solution
 
Imme-emosolCommented:
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.
0
 
flashactionsAuthor Commented:
ill try it and ill let you know.  im at work right now answering the 911 lines.  call me if you nedd me.  
0
 
flashactionsAuthor Commented:
drumloop1 is the linkage name.
0
 
Imme-emosolCommented:
I'm guessing here, can't test it right now, don't have access to an system with proper flash support...   :D

var mySound:Sound = new Sound();
mySound.attachSound(drumloop1);
mySound.play();


Or maybe just
drumloop1.play();
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now