-
Preloader Help
i need someone who could help me make a good preloader (bar, percent, etc.)Or just give me the script.
i only know the really basic forms of actionscript (play, stop, startdrag, etc.) thx in advance.
Last edited by spxmgb; 08-19-2005 at 02:01 PM.
-
search for preloader in the tutorials or in the movies section. i have found a lot of help there.
-
Senior Member
heres the one I use (stripped down a little)
onClipEvent (enterFrame) { // as long as this clip is shown do the following..
tb = math.round(_root.container.getBytesTotal()/1024); //create a variable name for totalBytes
lb = math.round(_root.container.getBytesLoaded()/1024); //create a variable name for bytesLoaded
if (tb>0 && lb>0) { // check to see both are 0% to start checking
this.percent = math.round((lb/tb)*100); // I have a dynamic text field called "percent" to show the percentage loaded
this.gotoAndPlay(this.percent); // the code is attached to THIS clip which is just a 100 frame long animation (progress bar) that will move the playhead to whatever frame number the dynamic text field is showing as the percent loaded.
if (lb>=tb) { // If loadedBytes is greater/equal too totalBytes the do the following...
_root.transition.gotoAndPlay("out"); // this plays the OUTRO transition animation tween..
_root.preloader.gotoAndStop("stop"); // this resets the prelaoder movieClip back to a blank frame..ready to start checking again when we call it.
}
}
}
I will attach a .fla for you too look at..
special notes are as follows:
1.) the buttons set a variable LOAD to a name (ie: about.swf) that the transition tween/animation checks ona frame action..
2.) example: transition tween.. slides in..and stops (stop; action) as it covers the OLD content..it checks for the variable "LOAD" for what external.swf to load into a container (empty) clip....
3.) on this STOP frame..(in other layers)...I have my preloader clip doing/checking the code above......once everythign is loaded..it will push the playhead along..playing the rest of the transition tween..and on the LAST frame..I have code to initialize the loaded external.swf that has been loaded into a container clip to stop playing.
_root.container.play();
stop();
So on my ROOT time line I have two layers that you need (could be one..as I do now..but this was an old one).. I have my TRANSITION layer....that is just the transition tween movie clip with a few frame actions (start/stop and starting the preloader movie clip as well)
and I have my preloader clip the has 2 frames (first is blank with STOP; action) second holds my progress bar clip.. the progress bar clip is what has the code obve on it...
hope it helps..once you get it figured out..it is really really easy.. this just seems complicated as mine is part of a whole site...
I only use one preloader/transition for EVERYTHING that is loaded into my site..
-
Hi whispers,
I checked the FLA you attached above, searched through the entire thing and couldn't find any of the code you pasted above - only stop commands - Am I missing something?
-
Senior Member
yes..you are..LOL.. most of the code in attached directly ON the MC's..
so the ONLY 3 layers you should ever look in would be:
1.) transitions layer
2.) preloader layer
3.) and than at the VERY end check out the buttons layer and see the code used to a.) start the transition clip playing...and b.) set what external.swf is to be loaded by setting a variable checked later.
1st step: open transition clip you will about mid way there are some FRAME actions:
Code:
stop();
_root.container.loadMovie(_root.load); // LOAD is averiable set by the button to tell what external.swf to load
_root.preloader.gotoAndPlay("start");
2nd step: open the preloader clip (preloder layer from _root)..
First frame is blank and a stop action so it isnt seen on stage until called, so the second frame is where the preloader clip is at. (the preloader clip consists of a dynamic text field (labeled "percent") and a movie clip of the progress bar(called "poleClip") and has THIS code ON it:
Code:
onClipEvent (enterFrame) {
tb = math.round(_root.container.getBytesTotal()/1024);
lb = math.round(_root.container.getBytesLoaded()/1024);
if (tb>0 && lb>0) {
this.percent = math.round((lb/tb)*100);
this.gotoAndPlay(this.percent);
if (lb>=tb) {
_root.transition.gotoAndPlay("out");
_root.preloader.gotoAndStop("stop");
}
}
}
3rd step: If you lok at the end of the code above...you see that once the external content is loaded ( if (lb>=tb) ) we turn the preloader "OFF" (back to the blank STOP; frame)..and we start the transition movie clip on _root to play the rest of the tween.
4th step: if you look at the last FRAME of the transition clip..you will see an initialize statement to start the external.swf content to play in the container clip (where it was just loaded into)
Code:
_root.container.play();
stop();
5th step: go to the buttons layer on _root and see the code used to start the whole process "&" set the variable "LOAD" to have a value of what we want loaded.
Code:
on (release) {
_root.transition.gotoAndPlay("in");
_root.load = "about.swf";
}
some links to where we have talked about this before: (may help you understand it better)
http://www.flashkit.com/board/showth...ight=preloader (post #22..explains the WHOLE process)
http://www.flashkit.com/board/showth...ight=preloader
-
Odisey
Preloader and flv files
Whispers,
Can this preloader be used to load a movie clip with an flv embedded in it? The buffering that happens with clips that have an flv in them is a bit different than normal clips. I would like a preloader that plays on stage while the movie buffers only -- not the entire clip.
Know a good way to add a preloader that functions this way? I have an empty_clip on stage, and the clip with the flv in it is called to replace the empty_clip. Seems that your preloader may work if it is configured properly.
Odisey
Much to learn.... Much to learn....
-
Senior Member
my preloader is set to work on ANYTHIGN that is loaded into a "container clip" (empty mc) you can load .jpgs or external.swf's..
I do NOT mess with video ever..so I really couldnt say for sure.. but I dont see why it wouldnt...
it may a little more intrictae than most..and I can prbably walk you through only the BASICS needed... I have alot of "TRIGGERS" that play off of each other..that you may or may NOT need... my preloader is tied into my transition animation.
(if you looked the posted .fla you knwo what I mean)
-
Click here. Simple preloader walkthrough, with a bunch of tutorials.
-
Senior Member
LOL.. psssss.. (check the date homie)
-
gotoandlearn.com has a really good tutorial on preloaders, and lots of other great goodies!
-
Odisey
Merry Christmas
Thanks for the replies -- Eventhough it took you guys three years to respond. You know that the newer versions of Flash approach many preloader and other problems we encounter making the Web a more beautiful and interesting place to visit.
If FLASH continues to improve -- we will all wind up in the coffee lounge.
Have a nice and productive 2006.
ODC
Much to learn.... Much to learn....
-
Senior Member
?? you got answeres when you posted.
-
Originally Posted by whispers
heres the one I use (stripped down a little)
onClipEvent (enterFrame) { // as long as this clip is shown do the following..
tb = math.round(_root.container.getBytesTotal()/1024); //create a variable name for totalBytes
lb = math.round(_root.container.getBytesLoaded()/1024); //create a variable name for bytesLoaded
if (tb>0 && lb>0) { // check to see both are 0% to start checking
this.percent = math.round((lb/tb)*100); // I have a dynamic text field called "percent" to show the percentage loaded
this.gotoAndPlay(this.percent); // the code is attached to THIS clip which is just a 100 frame long animation (progress bar) that will move the playhead to whatever frame number the dynamic text field is showing as the percent loaded.
if (lb>=tb) { // If loadedBytes is greater/equal too totalBytes the do the following...
_root.transition.gotoAndPlay("out"); // this plays the OUTRO transition animation tween..
_root.preloader.gotoAndStop("stop"); // this resets the prelaoder movieClip back to a blank frame..ready to start checking again when we call it.
}
}
}
I will attach a .fla for you too look at..
special notes are as follows:
1.) the buttons set a variable LOAD to a name (ie: about.swf) that the transition tween/animation checks ona frame action..
2.) example: transition tween.. slides in..and stops (stop; action) as it covers the OLD content..it checks for the variable "LOAD" for what external.swf to load into a container (empty) clip....
3.) on this STOP frame..(in other layers)...I have my preloader clip doing/checking the code above......once everythign is loaded..it will push the playhead along..playing the rest of the transition tween..and on the LAST frame..I have code to initialize the loaded external.swf that has been loaded into a container clip to stop playing.
_root.container.play();
stop();
So on my ROOT time line I have two layers that you need (could be one..as I do now..but this was an old one).. I have my TRANSITION layer....that is just the transition tween movie clip with a few frame actions (start/stop and starting the preloader movie clip as well)
and I have my preloader clip the has 2 frames (first is blank with STOP; action) second holds my progress bar clip.. the progress bar clip is what has the code obve on it...
hope it helps..once you get it figured out..it is really really easy.. this just seems complicated as mine is part of a whole site...
I only use one preloader/transition for EVERYTHING that is loaded into my site..
Hi Whispers,
Reading this post much later than it was posted, and can't see the fla attached... or any of the other posts you have on this preloader stuff...
Could I have the link please?
thanks so much in advance...
-
Senior Member
in my footer are some links to preloader help....
as well as several .fla's in thread you posted a link to AND links to other threads explaining how it is done... some of the other memebers just posted my .fla back up .....but those MX versiosn I believe... the links in my footers are for F8..
-
Thank you, will check them out
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|