Playing laser sound while pressing spacebar as3

Trying to figure out a code for my ship when i press spacebar and fires the laser a sound will play

private var reqButton:URLRequest = new URLRequest("laser.mp3");
private var buttonSound:Sound = new Sound(reqButton);

if (key.isDown(Keyboard.SPACE))

ok this worked the only 2 things i need was to add



You can try this if you have an external sound in an "audio" folder

var reqButton:URLRequest = new URLRequest("audio/button.mp3"); 
var buttonSound:Sound = new Sound(reqButton);

and then your keypress code:

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
    function keyDown(event:KeyboardEvent):void

        case 32:  //Space Bar 
            //trace("Space Bar");


Need Your Help

Solr full-text search without an index?

php mysql full-text-search solr

Does solr search index content independently, or use the full-text index in the mysql table, because I have got a 22K record table that I want to enable full-text search on it, but I currently I do...

Android: Add OnTouch to a dynamic row to make Intent

android eclipse android-intent

I've made the table to make rows dynamically. I'm trying to make onTouch event, and if it triggers then move on to another activity using intent. I can't make it to work it says:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.