Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preloading Sound In Parent Movie

Status
Not open for further replies.

theKeyper

Technical User
Jun 11, 2003
79
AU
OK, So I'm trying to Preload Sound in My Main Preloader. However I only want the Sound to start playing in a seperate SWF loaded at level 50. So far this is my code on Frame 1 of the Preloader Page.

firstSound.loadSound ('../Assets/Sounds/Main_Background.mp3', false)

secondSound.loadSound ('../Assets/Sounds/Main_Background2.mp3', false)

thirdSound.loadSound ('../Assets/Sounds/Main_Background3.mp3', false)

fourthSound.loadSound ('../Assets/Sounds/Main_Background4.mp3', false)

SoundBytesTotal =(_root.firstSound.getBytesTotal())+(_root.secondSound.getBytesTotal())+(_root.thirdSound.getBytesTotal())+(_root.fourthSound.getBytesTotal());

SoundBytesLoaded=(_root.firstSound.getBytesLoaded())+(_root.secondSound.getBytesLoaded())+(_root.thirdSound.getBytesLoaded())+(_root.fourthSound.getBytesLoaded());

BytesTotal =getBytesTotal();
BytesLoaded=getBytesLoaded();

percent = Math.round((SoundBytesLoaded+BytesLoaded)/(SoundBytesTotal+BytesTotal)*100);

PercentLoaded.text = percent+"%";

So that works. Then I load an SWF at level 50 which has this code:

PlaySong = random(4);

if (PlaySong == 0) {
_parent.firstSound.start(0, 999);
} else if (PlaySong == 1){
_parent.secondSound.start (0, 999);
} else if (PlaySong == 2) {
_parent.thirdSound.start (0,999);
} else {
_parent.fourthSound.start (0,999);
}
stop();

This gives me no sound. I've been playing with this for days now but always either the preloader or the sound works, Never both.

I would really appreciate any help on this one. I know this code is kind of long so thank you for giving your time and patience.

At Your Service,
-Keyper

 
i am surprised that preloader stuff works but i assume all is well

why _parent is it 1 level down in a movieclip ?

and why the _roots


at a guess i would try _level0.firstsound.start();


etc


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top