A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: music infinite loop?

  1. #21
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    So...with that tutorial Fruitbeard posted, you can do something like this to loop the music:

    PHP Code:
    onFrame (3) {
      
    mySound = new Sound();
      
    mySound.loadSound("song1.mp3");
      
    mySound.start(0999); 
    mySound.onSoundComplete = function () { 
    mySound.start(0999); 


    I've not tested it so i can't tell 100% it will work, but it should. Just replace "onFrame (3)" with the number of the frame of the scene you want the sound to start playing. It will keep playing throught all the frames until the last frame. If you don't use a stop(); on the last frame, the movie probably will repeat from its first frame, so the sound will start again over the already playing sound... so if you come up to this situation, i will read the swish tutorial to help you out.
    In as2, i would do something like:
    PHP Code:
    onFrame (3) {
    if(
    mySound.position != mySound.duration)
    {
    trace("it's playing");
    };
    else
    {
    trace("it's not playing");
      
    mySound = new Sound();
      
    mySound.loadSound("song1.mp3");
      
    mySound.start(0999); 
    mySound.onSoundComplete = function () { 
    mySound.start(0999); 
    }

    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  2. #22
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    The AS2 equivalent of "int.MAX_VALUE" is " Number.MAX_VALUE"

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