Hey guys,
I have this issue:
My whole content, the flash site is 80kB.
If i load one mp3 as an ambient music, it jumps to 400kB, which is not so good.
I was wondering is there any possible way that I could load the content as 80kB, and once its completely loaded, to begin loading the ambient sound ? also perhaps this sound should stay in a different swf or something so that it does not extend my main swf too much?
Thanks in advance for suggestions.
Author
Hey mate, thanks for your answer.
I need this sound to be my background music for the website, so its not an object event (well it is an event actually if you think of it as playing when the _root.onLoad=function() - so when the root loads).
I am a bit confused, can you please point me in the right direction about the streaming suggestion? a bit of code would be much appreciated.
So actually, all I need is that I load this sound file from outside my main swf , even if that means inserting it into another separate swf . by doing so, it will not modify the size of my main swf.
- 23 November 2006 11:46 AM
-
this topic is beaten to death, u could search a bit in the forums, anyway hope that helps:
- 23 November 2006 12:07 PM
-
The Sound class also has getBytesLoaded() and getBytesTotal() methods, so you can check the load progress easily enough if you don’t want to stream the audio.
[as]var mySound:Sound = new Sound();
var loadInterval:Number;
function loadSound(url:String):Void
{
if (loadInterval)
{
clearInterval(loadInterval);
}
mySound.loadSound(url);
loadInterval = setInterval(this, “checkLoadProgress”, 100);
}
function checkLoadProgress():Void
{
var percent:Number = 0;
var bLoaded:Number = mySound.getBytesLoaded();
var bTotal:Number = mySound.getBytesTotal();
if (bLoaded && bTotal)
{
percent = (100 / bTotal) * bLoaded >> 0;
}
if (percent == 100)
{
clearInterval(loadInterval);
loadInterval = null;
mySound.play();
}
}
//
loadSound(“ambience.mp3”);[/as]
- 23 November 2006 02:58 PM
-
Author
thank you BVX, and Splat - you are amazing, that was my next question
- 23 November 2006 05:53 PM
-
- Log in or join for free to make a comment.


