Hellow fellow Flashers,
I’ve spent my entire weekend trying to get this working properly, and have combed through as many message boards and sites as possible. I could really use a hand…
I have followed the Kenny Bellew tutorial for preloading when using attachSound. It works pefectly when I use a button to initiate the loading, but acts wonky when I try to do it automatically. Anyone ever encounter this before?
[URL=“http://www.pixelsandpitches.com/preloadthat.html”]http://www.pixelsandpitches.com/preloadthat.html
Here is one test version I have been playing with. The part that is REALLY confusing me is that if I keep refreshing my page, sometimes the preloader will start as it should. Most times it just jumps ahead. (I have also tried it with clearing my cache each time…)
this is my code on my actionscript movie clip as demonstrated in the tutorial:
onClipEvent (load) {
_root.loadSound = 1;
_root.soundHolder.loadMovie("externalSoundObjects.swf");
_root.loadBar._xscale = 0;
}
//
onClipEvent (enterFrame) {
if (_root.loadSound == 1) {
soundsBytesTotal = _root.soundHolder.getBytesTotal();
soundsBytesLoaded = _root.soundHolder.getBytesLoaded();
trace (soundsBytesTotal)
trace (soundsBytesLoaded)
percentLoaded = Math.round((soundsBytesLoaded/soundsBytesTotal)*100);
if (percentLoaded>0) {
_root.percentLoadedText = percentLoaded+"%";
// Updates text box with the percent loaded.
_root.loadBar._xscale = percentLoaded;
// Causes movie clip "loadBar" to scale horizontally equal to the percentLoaded.
}
if (percentLoaded>99 && doOnce != 1) {
doOnce = 1;
_root.gotoAndStop("start");
}
}
}
Note that I put a trace in for **soundsBytesTotal and soundsBytesLoaded **because for some reason these both come up as “4” first time around - I think this must have something to do with it.
thanks muchly for any pointers!
mrfritter