A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Adding sound loop across scenes

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    11

    Adding sound loop across scenes

    I want to add a simple sound loop (only 300kb) to play across 3 scenes, that starts automatically and i need it to have a simple on/off button, how would i go about this? Should i load it from an external .swf? also if its going to not load instantaneously i would need some sort of preloader aswell.
    Does anyone know how to achieve this?

    Erik

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    i favor loading an external swf with a global sound object
    Code:
    //  in sound.fla -
    _global.sndtrack = new Sound(this);
    sndtrack.attachSound("thesound");
    sndtrack.stop();
    Code:
    // in main.fla -
    someMC.loadMovie("sound.swf");
    // or load to level
    //  loadMovieNum("sound.swf",1);
    vol = 50;
    
    this.onEnterFrame = function(){
    if(sndtrack.duration > 0){
    sndtrack.setVolume(vol);
    sndtrack.start(0,999);
    delete this.onEnterFrame;
    }
    };
    hth

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