Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 5 of 5

Thread: desperate

  1. #1

    desperate

    ok so im in desperate need of some help. it should be pretty easy but in 24 hours i need to have a "game." all it has to do really is play a random sound file after a key is pressed 4-5 times. i have cs3 and i realllly need help on tihs because it has to be done in the next 20ish hours. ill pay for help even.

  2. #2
    u are leave homework last minute! hahaaha

  3. If it can be AS2, copy this to an empty fla, then import 5 sound and set their linkage identifiers sound0 to sound4. I'd be happy to explain the code to you if this is what you need. If it can't be AS2 and has to be AS3, good luck. You can probably learn from this and change it to AS3 though.
    Code:
    var keyListener:Object = new Object();
    keyListener.onKeyUp = function ()
        {
        playSound();
        }
    Key.addListener(keyListener);
    
    function playSound():Void
        {
        var sound:Sound = new Sound();
        sound.attachSound("sound" + getRandomNumber(0, 4));
        sound.setVolume(100);
        sound.start();
        }
        
    function getRandomNumber(min:Number, max:Number):Number
        {
        return (Math.floor(Math.random()*(max-min+1)) + min);
        }
    Good luck.

  4. #4
    actually this isn't homework. its for a children's charity in which we have a game that needs this. that code helped ALOT but it actually has to be a little more complicated. if you could help me further that would be amazing.

  5. #5
    what do you mean by "more complicated"....that will do what you wanted, but if you want something else, you should say exactly what you want.
    MY BLOG

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012