Hi guys… I’ve been having issues with preloading during runtime. Some of you have tried to help and I thank you greatly, but there is one thing left that I am stuck on. It seems for some reason that the function getBytesLoaded() just does not work properly in Flash MX.
I created a flash file, with the above simple code to test if the function works while the image loads. I made a rather large image, about 2MB so that even on my local machine it wouldn’t load instantly, and supposedly allow the enterFrame handler I used to trace getBytesLoaded(). I attached the code to a button so that I could simulate loading dynamically during runtime.
I play the .swf. The trace is already going. it’s ruturning 4 and 4 as the bytes loaded and total of an empty movie clip. thats fine. Then i click on the button which loads the image, and all of a sudden both values are at 1029500. (while showing streaming) one would think that the first one ‘getBytesLoaded()’ would increment up while the ‘getBytesTotal()’ would be 1029500. Well, the .fla is attached you guys can see for yourself.
I have a feeling that this is what’s causing all the problems with preloading. With no incrementing, there’s no way to tell if the image is currently loading. Someone know why??
thanks,
CommanderCool
also im not attaching the image, because it’s big, but you can use any image or url in the loadMovie function.
okay, here is the file on some server space. The getBytesLoaded does seem to work, but the problem here now is that the movie head jumps forward before the loading is done. Also the percent is read as NaN. (as soon as ‘total’ > 0 it should be a number…) Heres the code im using to control playback (set in frame 4):
yeah, right now im on a mac w/ OSX… funny i thought at least both platforms would open .fla files… hm… well you can see the code though… does it make sense that the movie would jump foward using that code?
omg, that actually works. you can see it at the link in my previous post (although you might need to clear your cache)… thanks a billion, Kax, I’ve been stuck on that for a while… although, satisfying as it is to see it working, i don’t get exactly what that small change is doing – if(_root.preloaded?) how does that return a ‘true’ or ‘1’? anyway, no more annoying posts from me… thanks again.