dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Can I have alternating MP3s stream from one button?

  1. #1
    Whoosie-whatsit
    Join Date
    Jul 2002
    Location
    ATL, shawteh
    Posts
    71

    Can I have alternating MP3s stream from one button?

    I have a slide show with two versions. One is auto-advance, and the other manual. I have three MP3s to play during the slideshow, and I want a different one to play each time one of the play buttons is clicked. The MP3 files are too big to put in one movie clip, and this is probably not the best method anyway. So I'm wondering, is there a way to stream the MP3s alternatingly (is that a word?)?

    Okay, so can someone help me with this? I know there must be a way to do this. I just can't quite grasp the concept. Even if someone can tell me whether or not it can be done, and then point me in the right direction on writing the AS I would be most grateful. I checked Kenny Bellew's and a couple of other sound tutorials for this, but either it isn't there or I missed it.

    Thanks,
    Summarah
    I'm putting myself in "time out!"

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    Yes - but load the mp3 externally - thus saving space - do a search on loadMovie() and random().

  3. #3
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    There are several ways to set something like this up. This is only one of a few possible ways.....
    code:

    //initialize a count variable
    songCount=0;
    //array to hold song titles
    mySongs=["song1","song2","song2","song4","song5"]
    //sound object
    mySound=new Sound(this);
    //button code for loading the appropriate song
    someButtonName.onRelease=function(){
    mySound.loadSound(mySongs[songCount],true);
    songCount++;
    //reset count variable
    if(songCount>mySongs.length){
    songCount=0;
    }
    }



    hope it helps
    NTD

  4. #4
    Whoosie-whatsit
    Join Date
    Jul 2002
    Location
    ATL, shawteh
    Posts
    71
    Thanks, NTD. I will try this and let you know how it turns out. 'Preciate it!

    Summarah
    I'm putting myself in "time out!"

  5. #5
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    Nice code NTD, except,when tested, it looks for a sixth song, when only five are in the array.
    If you don't think you're going to like the answer, then don't ask the question.

  6. #6
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Nice code NTD, except,when tested, it looks for a sixth song, when only five are in the array.
    I didn't test the code. I just popped it out of my head as some place to start. To fix the mentioned problem, just alter the if statement that checks the count variable to .....

    code:

    if(songCount>mySongs.length-1){
    songCount=0;
    }


Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center