The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: Is this possible? (rollover random sound sequence)

  1. #1

    Is this possible? (rollover random sound sequence)

    Hi! I'm a beginner to Actionscript and was wondering if the following was possible for a project I'm working on; I would like a sequence of randomly-generated sounds from my library to play when the cursor rolls over the stage. Rather than one single random sound playing on rollover I would like a sequence of the sounds played one after the other continuously. Is this possible to achieve in Actionscript 3 and if so, how am I able to achieve this? If it is not possible, are there any similar effects? Thanks a lot.

  2. #2
    Registered User
    hello - welcome

    it certainly is possible - although it's a little difficult to tell from your description exactly what your looking for here, because of the conflicting terms 'random' and 'sequence' but that said, you can use an array and an index to control the sequence, each time a sound is played, increment the index and play the 'next' sound in the array and recycle - something like this:
    var sounds:Array = [ Sound1, Sound2, Sound3, etc... ];
    var index:int = 0;
    function rollover( e:MouseEvent ):void {
        new sounds[index]().play();
        if(++index==sounds.length) index=0;
    in the above, each element in the array is a Class - or the linkage id of the Sound in the Lib that you define

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 Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012