Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getBytestotal of .swf

Status
Not open for further replies.

lumstar

Technical User
Jan 29, 2002
177
CA
Hey Guys,

I load a swf into my movie using the loadMovie command. I want to be able to read the size of the swf so I can create a preloader for this movie. How do i go about this? Lumstar

______________________________________
Keep On Coding!!
If my post helped you, please give me a star.
If your post helps me, I'll give you one!
scifi-alien-with-red-boots-DW.gif
 
Preloader should normally be in the "to be loaded" movie itself, not in the main movie!

On an actions layer...
Frame 1:

if(_root.getBytesLoaded() >= _root.getBytesTotal()){
gotoAndPlay("Scene 1",1);
}
// Only to avoid seeing a flash frame of the preloader
// on Refresh or subsequent visits.
// Frame should remain blank on all layers, and no
// textfields displays or animations

Frame 2:

if(_root.getBytesLoaded() >= _root.getBytesTotal()){
gotoAndPlay("Scene 1",1);
}
// Here's where you would add textfield displays
// calculations to display loaded bytes, total bytes
// and/or percentage...Etc...Etc...

Frame 3:
gotoAndPlay(2);

Textfields displays and/or animation should be added on their own layers, but on frames 2 and 3 only. Frame 1 should remain clear of any displays or animations outside of the action script. Regards,

new.gif
 
Thanks Old,

Only thing is, this isnt a preloader for the entire movie, just for the one swf. This is needed so that i can have the background of my site change if the user picks a different one. I want to be able to show a loader for the new background.

Rgds, Lumstar

______________________________________
Keep On Coding!!
If my post helped you, please give me a star.
If your post helps me, I'll give you one!
scifi-alien-with-red-boots-DW.gif
 
Yes, it's possible to have a preloader in the main movie, that will display the loading bytes of an external .swf, but since you have acces to the .fla of this (these) background movie(s), adding a preloader to "the to be loaded" movie itself, will work as well, displaying the first time around, and skipping the preloader, when it's already in the user's cache.
Regards,

new.gif
 
That's cool, but my external swf has it's own preloader of the type you describe, yet the preloder doesn't show up at all untill the whole external swf loads, then it just shows the content after the loader... arggh!

ideas?

poaster.gif
 
When the main movie loads another movie, it stops and waits for the other movie to finish loading. That is why the preloader needs to be part of the loading movie.

You can have the loading movie force the main movie to continue to play with the _parent.play() command.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top