A tutorial idea: "multiple .swf preloader w/ total %&qu

Ive been scouring the net for a “working” example of how to get a preloader to load multiple .swf files into _levels, and calculate the total bytes. \r\rIdeally I’m looking for one preloader to exist on level0. Instead of individual preloaders on each level. Im doing the typical navigation on level0, content on other levels.\r\rI’ve found an example that uses an array for the loading of the levels, which is great for keeping future updating localilized. But its beyond my debugging skills.\r\rSounds easy enough, but I haven’t found one that works for me!\r\r-georgekaplin

Hear Hear to that!\r\rall tutorials Ive found use scenes and little preloaders everywhere. how about a global and accurate preloader\r\rdave

question though… is there a valid reason for not using the same preloader on each new movie that loads. You could use a shared library to share a preloader movie clip between all of the movies, then when it was downloaded once, the computer viewing it would never have to download it a second time… hence solving the problem of added file size. Is there some reason besides file size for which you need to do this?

When the movie first loads Id like one loading bar to account for all loaded levels. To return the bytes loaded for all _levels.\r\rIf each loaded movie has a preloader (even the same _mc) won’t the bar keep popping back to zero each time a movie loads?\r\rBasically Im trying to have one percentage counter that accounts for several movies on several levels.\r\rMaybe its just my syntax, but the following code doesn’t work.\r\r-georgekaplin\r\rThis is one frame 2, frame 1 loads the movies.\r\r\ronClipEvent (enterFrame) {\r&nbsp &nbsp &nbsp &nbsp totalBytes = ((_level1.getBytesTotal()+_level2.getBytesTotal()+_level3.getBytesTotal()+_level4.getBytesTotal()+_level5.getBytesTotal()+_level6.getBytesTotal()+_level7.getBytesTotal()+_level8.getBytesTotal()+_level20.getBytesTotal())/1000);\r&nbsp &nbsp &nbsp &nbsp bytesLoaded = ((_level1.getBytesLoaded()+_level2.getBytesLoaded()+_level3.getBytesLoaded()+_level4.getBytesLoaded()+_level5.getBytesLoaded()+_level6.getBytesLoaded()+_level7.getBytesLoaded()+_level8.getBytesLoaded()+_level20.getBytesLoaded())/1000);\r&nbsp &nbsp &nbsp &nbsp percentLoaded = Math.floor(bytesLoaded/totalBytes*100);\r&nbsp &nbsp &nbsp &nbsp if (percentLoaded>0 && percentLoaded<100) {\r &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.blah=percentLoaded+" %";\r &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.loadingbar.gotoAndPlay(percentLoaded);\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.totalBytes=totalBytes+" KB";\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.bytesLoaded=bytesLoaded+" KB";\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.bar.gotoAndStop(percentLoaded);\r\r&nbsp &nbsp &nbsp &nbsp }\r\r&nbsp &nbsp &nbsp &nbsp if ((totalBytes>100) && (percentLoaded >= 100)) {\r &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.gotoAndPlay(“loaded”);\r&nbsp &nbsp &nbsp &nbsp }\r}

Well…that’s certainly a good question coming from THAT perspective. You’re correct, I was not understanding what you were looking for.\r\rI’ll do a little experimentation on this and see what I can come up with.\r\rperhaps this would work.\r\rIf everything in each level were in a movie clip, then you could target that movie clip to getBytesLoaded and Total.\r\rI’ll see what I can figure out though

ok… from what I’m reading I can see this at least. getBytesTotal, and getBytesLoaded is a movie clip method… I do not think that it will work the way you’re trying to get it to work.\r\rIs there anyway that you can load those swf’s into movie clips on your _level0, rather than into levels? If so, then you can target each movie clip by name

Ill give it a whirl, loading into MCs instead. It will take some doing because Im new at this and my site prototype buttons all call for action based on _levels.\r\rIf there are several swf files loaded into MovieClips, then all MCs will exist on _level0. If everything is loaded up on frame two of _level0, then wouldnt my preloader only need to calculate the ifframeloaded(2) for level0?\r\r-georgekaplin

In order to control the individual mc’s controllable with the nav bar I have, Ive got to name them sequencially. “mc1”, “mc2” and so on.\r\rIn the first frame Ive got:\ronClipEvent (load) {\r_root.mc1.loadmovie(“content.swf”);\r_root.mc2.loadmovie(“content2.swf”);\r}\r\rThe question then becomes, since I need a specific name for the mc’s, do I need to place prenamed, blank mcs on the stage first. Or does the loadMovie create the mc?\r\rAnd, does this work through scenes. If the onClipEvent, shown above is on the “preloader” scene. How do I create mcs on “scene2”?\r\rAt this point Im wondering if my unsteady preloader is just darn fine enough!\r\rThanks for the input BTW\r-georgekaplin

Ive answered my last question by pure determination.\r\rbut now…\r\rIve changed my movie to load the external swf files into MCs. But the ifframesloaded dingus doesnt seem to care that the external swf’s arent loaded.\r\rMy preloader is a standard (on Scene 1):\r\rifFrameLoaded (“Scene 2”, 2) {&nbsp &nbsp &nbsp &nbsp \rgotoAndPlay (“Scene 2”, “play”);}\r\rand I load the swfs into MC in “Scene 2”, frame 1.\r\rShould I load the MCs in the preloader scene? And if so do I reload them in Scene 2 to get them back on the stage?\r\r-georgekaplin

I’m working on this, this weekend. Hopefuly I’ll have an answer for you by monday.

to add to the fun, someone else (on another board) gave me this solution. It worked, but I barely understnad why and am having problems modifying it.\r\ronClipEvent (load) {\r aMovie = new Array();\r aMovie[0] = [“navigation.swf”, “home.swf”, “profile.swf”, “capabilities.swf”, “creative.swf”, “portfolio.swf”, “jobs.swf”, “contact.swf”, “site.swf”];\r aMovie[1] = [20, 1, 2, 3, 4, 5, 6, 7, 8];\r}\r\ronClipEvent (enterFrame) {\r if (!fLoadIssued) {\r fLoadIssued = true;\r for (i=0; i<aMovie[0] .length; i++) {\r _root[“mc”+aMovie[1]* ].loadMovie(aMovie[0] * );\r }\r fLoadLoopDone = true;\r }\r if (fLoadLoopDone && !fLoadTotalAvailable) {\r fLoadTotalAvailable = true;\r nBytesTotal = 0;\r for (i=0; i<aMovie[0] .length; i++) {\r if (_root[“mc”+aMovie[1]* ].getBytesTotal()<10) {\r fLoadTotalAvailable = false;\r } else {\r nBytesTotal += _root[“mc”+aMovie[1]* ].getBytesTotal();\r }\r }\r }\r if (fLoadTotalAvailable && !fLoadDone) {\r nBytesLoaded = 0;\r for (i=0; i<aMovie[0] .length; i++) {\r nBytesLoaded += _root[“mc”+aMovie[1]* ].getBytesLoaded();\r }\r nPercentLoaded = Math.floor((nBytesLoaded/nBytesTotal)100);\r if (nPercentLoaded<100) {\r _root.bar.gotoAndStop(nPercentLoaded);\r } else {\r fLoadDone = true;\r _root[“mc”+aMovie[1][0] ].gotoAndPlay(“play”) ;\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndPlay(“blank”****