-
Bypass preloader if cached
How can I bypass the preloader if someone has the specific swf already cached. I have 2 frames on the main timeline. the first has a stop action in an empty mc and a preloader with the following code:
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}
In the second frame I have my main movie. Any help would be great from those of you who know as better than me. Thanks ya'll.
[pk]
Last edited by Philip Konya; 07-07-2005 at 04:50 AM.
-
on the first frame put
if (_root.getBytesLoaded() == _root.getBytesTotal()){
gotoAndStop(2);
}
-
When I do this
on the first frame put
if (_root.getBytesLoaded() == _root.getBytesTotal()){
gotoAndStop(2);
}
it bypasses the preloader all together. Even when viewing for the first time. I am not sure why?
[pk]
-
It doesnt check if you're there for the first time or not but if it has loaded. If you want to show preloader for visitors that are there for the first time, use shared object or cookies.
-
Originally Posted by Philip Konya
When I do this
it bypasses the preloader all together. Even when viewing for the first time. I am not sure why?
[pk]
because when nothing has loaded both are equal to 0, thus .. equal, and the if statement returns true.
The usual way to write that line of code is more like:
if (_root.getBytesLoaded() > 4 && _root.getBytesLoaded()== _root.getBytesTotal())
ensuring that at least something has started loading.
gparis
-
To answer your post, you could just set a variable to true when the loading is complete:
if (percent>99) {
_parent.loaded = true;
_parent.gotoAndStop(2);
}
then check for that variable first.
gparis
-
I think that would still expose his preloader, even for a second.
Maybe if the preloader would be visible only if the movie was not loaded into cache.
I never had problems with preloading main movies (replying to gparis's previous post) and geting their correct size, but only with loading swf's into main movie. However with so many different computer configurations and different browsers, one can never be too carefull.
-
I have in my 1st frame an empty keyframe with the following action:
if (percent>100) {
_parent.loaded = true;
_parent.gotoAndPlay(3);
}
On frame 2 there is a stop action in an empty keyframe. Under that (still in frame 2) is my preloader with the following action:
onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndPlay(3);
}
}
The preloader still shows even if it is cached. I am sorry that I keep pestering people with this. Just have not gotten it to work yet. What am I doing wrong?
[pk]
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
|