I have two swf files. One is intro and the other is loop.
The intro.swf loads the loop.swf into level1 using "loadMovie(“http://www.mydomain.com/loop.swf”, 1).
Now I can test my movie and it will play the bloody loop but when I upload the movie to the web server and load the page it just sits there playing NOTHING??? What is going on? I can test it and it plays, I can play the swf on my local drive and it plays, BUT when I upload the swf’s it won’t play.
Try the subtle changes below and see if that fixes it. Mainly semicolons and the start function parameters.
function mysound(){
//create a new sound object on this timeline note the "this" keyword
mysoundobj=new Sound(this);
//attach the sound from the library
mysoundobj.attachSound("scgolfpaks");
//play the sound and loop 1 time
mysoundobj.start();
}
Depending on how long your songs are they might still be loading over the web. If you are using MX you can load mp3s externally without having to import them into the Flash library. Try this code:
function mysound(){
//create a new sound object on this timeline note the "this" keyword
mysoundobj=new Sound(this);
//PLACE external mp3 file in same folder as loop.swf
mysoundobj.loadSound("scgolfpaks.mp3");
//play the sound
mysoundobj.start();
}
onClipEvent(load){
//load the sound movie
loadMovieNum(“loop.swf”,1)
}
onClipEvent(enterFrame){
//create a percentage
percentloaded=Math.floor((_level1.getBytesLoaded()/_level1.getBytesTotal())*100)
//remove this if you dont want to display a percentage
percentdisplay=percentloaded + "%"
//if the movie is fully loaded
if(percentloaded == 100 && !initialize){
//call the function that creates out new sound and plays it
_level1.mysound()
//dont call call the function again
initialize=true
//hide this movieclip
_visible=false
}
When using attachMovie you must export the clip to the first frame.
This is the little know Frame 0 in Flash.
Your movie starts on Frame 1, but all exported for actionscript clips start on Frame 0 and therefore load BEFORE your movie actually plays. Causing a delay.