Debug needed: "preloader for swf files loaded into MC's

Ok. So I’m loading several content pages (.swf) into blank mc’s. And then attempting to control them from _level0 (the original movie). \r\rBut the swfs add up to a bit of KB so Id like to make sure they are preloaded before I tell one of them to play (the navigation). \r\rNotes: \r-each .swf has a stop on the first frame so it wont start right away.\r-blank mc’s are already on the stage \r\rHere’s where I am… \r\rframe 1: \r\ronClipEvent (enterFrame) { \r_root.mc20.loadMovie(“navigation.swf”) \r_root.mc1.loadMovie(“home.swf”); \r_root.mc2.loadMovie(“home2.swf”); \r} \r\rframe 2 (the preload check): \r\ronClipEvent (enterFrame) { \rtotalBytes = _root.mc1.getBytesTotal()+_root.mc2.getBytesTotal()+_root.mc20.getBytesTotal(); \r\rbytesLoaded = _root.mc1.getBytesLoaded()+_root.mc2.getBytesLoaded()+_root.mc20.getBytesLoaded(); \r\rpercentLoaded = Math.floor(bytesLoaded/totalBytes*100); \r\rif (percentLoaded>0 && percentLoaded<100) { \r_root.bar.gotoAndStop(percentLoaded); \r\r} \r\rif (totalBytes == bytesLoaded) { \r_root.mc20.gotoAndPlay(“play”); \r} \r} \r\r\rbut…I cant get it to work…preload or even play mc20. \r\rthank you,\r \ravlisdivad\r

you know… a lot of people have been asking about this. I’ll see what I can figure out… no solutions yet.

Ive modeled this preloader off of a few other posts. But none of the threads had answers, so I asked myself!\r\ravlisdivad

frame 1: \r\ronClipEvent (enterFrame) { \r _root.mc20.loadMovie(“navigation.swf”) \r _root.mc1.loadMovie(“home.swf”); \r _root.mc2.loadMovie(“home2.swf”); \r} \r\r-------------------------\rWhat do you mean by this? It seems as if you’re using an onClipEvent in a “frame” action. That wont work. It should look like this at the very least.\r\rmc20.loadMovie(“navigation.swf”);\rmc1.loadMovie(“home.swf”);\rmc2.loadMovie(“home2.swf”);\r\ras long as your mc1 20 and 2 are all on the main timeline, you don’t need the _root extention, and OnClipEvents are reserved for attaching to movie clips.\r\r-------------------------------\rframe 2 (the preload check): with notation\r\r//1totalBytes stuff\r1totalBytes = _root.mc1.getBytesTotal();\r1bytesLoaded = _root.mc1.getBytesLoaded();\r\r//2totalBytes stuff\r2totalBytes = _root.mc2.getBytesTotal();\r2bytesLoaded = _root.mc2.getBytesLoaded();\r\r//20totalBytes stuff\r20totalBytes = _root.mc20.getBytesTotal();\r20bytesLoaded = _root.mc20.getBytesLoaded();\r\r//total it up\rtotalBytes = 1totalBytes+2totalBytes+20totalBytes;\rbytesLoaded = 1bytesLoaded+2bytesLoaded+20bytesLoaded ;\r\r//bar manipulation\rpercentLoaded=Math.floor(bytesLoaded/totalBytes*100); \rif (percentLoaded>0&&percentLoaded<100) { \r bar._xscale=percentLoaded;\r} \r\rif (20totalBytes == 20bytesLoaded&&20totalBytes!=0) { \r mc20.gotoAndPlay(“play”);\r}\r----------------------------\rNote that I used a different kind of bar than you were using. I just make a bar of some length depending upon the stage and such. This script just tells it to scale x. Mind you when I do this I will modify the centerpoint of the bar clip so that it rests on one edge or the other. that way the bar will scale out from that point.\rI also added something to the if statements. First, I took the totals from each individual movie clip just to have them handy. If you don’t need one, don’t bother with that part of the script. But in this case, I think it might be better to take just the 20 movie’s loaded and total stats. This way it’s not waiting on anything else…\rYou can easily add more if statements for each of the other clips if you need to.\r\rI also added “&&20totalBytes!=0” to the end of the if statement. Sometimes when a movie first starts playing, it will register as having 0 bytesTotal and 0 bytesLoaded. Hence they are equal, and it tries to get whatever it’s waiting on to play or worse goto a frame that doesn’t exist yet. So on all of my preloaders I add that to the end of the if statement.\r\r\r-----------------------------\rframe 3\r\rgotoAndPlay(2);\r\r-------------------\rYou have to loop this script so that frame 2 is played over and over again. that way every frame it gets an update to the size of the bar, and the chance of one of the objects playing.