View Full Version : desperately need preloader help
blueninja78
02-19-2004, 06:51 AM
Can anyone help me with a preloader problem that I am having? I am working on a site
www.putthecameraonme.com
I have tried about 5 different preloader techniques but keep getting the same problem; The preloader doesn’t appear until the site is almost completely loaded. Has anyone else encountered this problem? If ANYONE can help me I would appreciate it. If you can help please email me at cam@blueninja.net
Thank you
buddaRhubarButta
02-20-2004, 09:11 PM
here is an easy preloader to get you started. create this once to get the hang of it and then design it how you'd like once you understand how it works. this'll be a simple preloader with a bar that shows percent done.
create a new movie clip named "bar."
in this movie clip create a bar with a fill and an outline. put the fill and the outline on separate layers and create a third layer for the script. now make each layer extend to the 100th frame and create one keyframe at frame 100.
on frame one resize the fill of the bar you created earlier so it is barely visible and position it all the way to the left of the outline of the box so that frames 1-99 display the sliver and frame 100 displays a full bar.
select the bar in frame one again and go to the frame tab. under tween select "shape."
if you would like you can also display some text such as "loading movie" or something like that but be sure not to put anything else on the tweened layer other than the sliding bar.
on the script layer of the movie clip create a keyframe on frame 1 and attach this code to it:
stop();
now the movie clip is ready to be inserted into your main timeline.
on frame one of your main timeline create an instance of the bar movie clip and type "bar" as the instance name. make sure you name the instance. have this frame extend to the second frame as well (you can do this easily by highlighting the frame in the timeline and pressing F5).
create a script layer in the main timeline. both frames have their own keyframe. On frame one attach this code:
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
if (percent_done == 100) {
gotoAndPlay (3);
}
this basically detects how many bytes are loaded and how many bytes total and divides them to get a percent done. it then tells the playhead to go to the corresponding frame number in the bar movie clip so that the sliding bar corresponds with the percent done.
on frame two add this code:
gotoAndPlay (1);
this tells it that the movie is still loading and should return to the first frame. part of the code on the first frame says that if the percent done = 100 go to frame 3 which is where you should start your project.
hope this works out for you!! let me know if there are any problems. oh and a preloader does not really work in the test mode, you can really only test it online.
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.