keyboard event listner/play sound flash cs3

Posted on 2007-08-01
Last Modified: 2008-01-09
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();
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."
Question by:flashactions
    LVL 3

    Expert Comment

    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):;

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

    Maybe try this:
    var mySound:Sound = new Sound();;

    I do not know you drumloop1 object//class.

    Good luck.
    LVL 1

    Author Comment

    ill try it and ill let you know.  im at work right now answering the 911 lines.  call me if you nedd me.  
    LVL 1

    Author Comment

    drumloop1 is the linkage name.
    LVL 3

    Accepted Solution

    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();

    Or maybe just;

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
    While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to how to record live broadcast.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now