flash question
- Started
- Last post
- 5 Responses
- freshmode
I am building a preloader that isn't working and was wondering if anyone has ever had this problem.
here is the code.
:::
percentLoaded = (_root.getBytesLoaded() /
_root.getBytesTotal())*100;
percentToLoad = 100;
if (percentLoaded >= percentToLoad) {
gotoAndPlay ("content", 1);
} else {
gotoAndPlay (1);
}
::::that script is on frame 3
frames 1 & 2 contain the same content with no scripts.
the problem I am having is that it loads 70% before it even starts playing frame 1. Then the preloader starts.
So you only see the preloader for 1 or 2 seconds but it takes about 5 seconds for the entire preloader. What am I doing wrong?
Thanks in advance
- arlo0
can you post the fla?
- Scotty5120
This will work:
btload = this.getBytesLoaded();
totbt = this.getBytesTotal();
percentloaded = btload*100/totbt;
if (btload>=totbt) {
// trace ("loading complete");
gotoAndPlay("content", 1);
} else {
gotoAndPlay(1);
}
- Scotty5120
Also:
Put the Code for the preloader on Frame 2 and all the content for the site on Frame 3...the problem is, if you have some big sized files on Frame 1, Flash player neeeds to load all that before it plays the frame, so no code will be called.
- freshmode0
The problem is that their is nothing on the first frame. And the other 2 frames only contain 1 piece of content which are both geometry. So it shouldn't be that hard to load. The entire file is 25k. Those 25k are in the next scene.
I will try what you have given me.
Thanks!
- boeser0
I had the same problem, in my case the problem was that I loaded a lot of objects out of the library. These were loaded before frame 1 started.
sounds familiar??