Copy link to clipboard
Copied
I have been using this tutorial to make a preloader:
http://www.republicofcode.com/tutori.../preloader_bc/
I have run into one problem though.
When I simulate the download, it just shows the background color of the game while it loads, and when it finished loading, it shows the loading screen fully loaded. I have followed the tutorial exactly, except added my file names into the AS2 code.
Here is the ActionScript in Frame 1 I have for the preloader:
if (_root.getBytesTotal() != _root.getBytesLoaded()){
stopAndGoto(1);
}
preloaderBar._xscale=(_root.getBytesLoaded()/_root.getBytesTotal())*100;
loaderTxt.text=Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100)+"%";
Any hints or answers to what i'm doing wrong?
Thanks, MrA615.
1 Correct answer
Place your other objects in frame 3 (or higher) of other layers
Copy link to clipboard
Copied
Your description of what you've done and the code you show does not match what the tutorial says to do and what code to use... (there is no stopAndGoTo() function in Flash).
Right-click the second frame on the upper layer labeled Actions and select Actions. Copy and paste the code below to make our preloader functional.
if (_root.getBytesTotal() != _root.getBytesLoaded()){
gotoAndPlay(1);
}
bar_mc._xscale=(_root.getBytesLoaded()/_root.getBytesTotal())*100;
loader_txt.text=Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100)+"%";
Copy link to clipboard
Copied
Thanks for replying.
I have just noticed that, tested it out by simulating the download, and it still doesn't work. When it loads, I can see that it is loading all the bytes, but it is not showing the preloader screen.
Here is my code as it is now.
if (_root.getBytesTotal() != _root.getBytesLoaded()){
gotoAndPlay(1);
}
preloaderBar._xscale=(_root.getBytesLoaded()/_root.getBytesTotal())*100;
loaderTxt.text=Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100)+"%";
Would you like to see the .FLA file?
MrA615.
Copy link to clipboard
Copied
If you can explain what you have done and maybe show a screenshot of your timeline, that will probably help. One other thing... what size of swf file are you dealing with here?
Copy link to clipboard
Copied
The SWF file is about 2 MegaBytes, and I don't think that should cause a problem. I also made the linkage for everything that was exported for ActionScript, had everything unchecked for "Export in first frame."
Here is a picture of the timeline. I have the background which is preBack, Bar/Percent which is the Bar Movie Clip and the text, and preAS which is the Action.
Also, when I simulate the download, I can see that it is loading, but shows the background color while it's loading. When it finishes, it just goes to the frame I commanded it to. (Frame 1)
Copy link to clipboard
Copied
Based on the timeline image you still are not doing what the tutorial instructs and what I pointed out that you need to do. I do not see any code in frame 2, which is where the code you showed is supposed to be. And when you are done with the preloading, you would not go to frame 1, you would go beyond frame 2 somewhere, where the rest of your file content should be.
Copy link to clipboard
Copied
I noticed that I had put the code in the wrong Frame. But now I switched the action to the 2nd frame, but still shows the background while it is loading.
Copy link to clipboard
Copied
Your preloader textfield and loader bar need to exist in frames 1 and 2. Maybe you should try going thru the tutorial again from the start, taking your time to follow each step. There are tutorials that are sloppily done and miss explaining things, but everything that you missed doing so far is properly explained in the tutorial.
Copy link to clipboard
Copied
Good News, I have started it from scratch, and it worked! But I noticed it only works if all of the content I want to load is in Frame 3 of the Content Layer. I have multiple layers of other objects to load. Any hints?
Copy link to clipboard
Copied
Place your other objects in frame 3 (or higher) of other layers
Copy link to clipboard
Copied
Yay! I worked! The only problem is that the loader bar shows up at about 90% loaded. Is there a way I can make that load first? And also, the text doesn't show up at all.
Copy link to clipboard
Copied
^ (Ignore the post above) ^
It worked!
I have run into a few problems though:
1. The loading bar showed up this time, but only at about 90%
2. The text for the bar doesn't show up at all.
3. The Custom cursor image doesn't work.
4. One of my images is not showing up in Frame 3.
I assume these steps should be easy, but at least the loading bar actually showed up!
MrA615.
Copy link to clipboard
Copied
Actually, nevermind! Problem completely solved! Preloader finished!
Thanks for your time and help. MrA615.

