This is what I have as far as code, it is in the first frame of the movie.
nature = new Sound(this);
nature.attachSound("sound_naturally");
nature.setVolume(50);
nature.start(0,0);
nature.onSoundComplete = function(){
nature.start(0,0);
}
trace(nature);
The trace outputs ‘[object Object]’ at runtime.
I have the sound exporting to ActionScript with the link identifier ‘sound_naturally’, not exported to the first frame. I don’t understand why it’s not working. I did like the exact same thing like 3 hours ago and it worked fine, but I lost the file so I had to redo it and now it won’t work at all.
Using Flash 10 with ActionScript 2.0
Both
start(0,0)orstart()are valid. Your code is not the issue here.What’s happening is that the sound file doesn’t get attached when exporting the SWF because it’s only sitting in your library and not being used anywhere. Obviously that’s why flash has “export in first frame”, but that makes things tricky for preloading, right? So, another option would be this:
This is a workaround solution, but ideally i would recommend loading sounds externally, using the
loadSound()method.Good luck !