Making a Preloader Using Flash
- robocopisback
-
robocopisback
- Member since: Jul. 26, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
Written by: robocopisback@newgrounds.com
Actionscript version: 2.0
Website: Funtut or Newgroundser - A site for Newgrounds.com fans
Description:
Making a preloader is very simple. In this tutorial, we will be learning on making a preloader. There are many reasons to have a preloader. Have you ever had a problem when you want to submit a game or movie on Newgrounds.com? Your file is to big when Newgrounds.com can only take a 10mb. That is why you make a preloader for your game or movie so that the site doesn't have to download it. All the preloader does is downloads the movie or game for you to watch it. So I hope that you enjoy the tutorial.
The tutorial:
First I want you to open a new Flash document. If you have "Adobe Flash CS3", on the main start up page (When it asks you for the type of actionscript version), choose "Actionscript 2.0". So, now make one more layer. Give the first layer a name called, "Preloader" and the second layer a name called, "Actions". Click the first keyframe in the "Actions" leyer, press "F9" (That will open the actions panel) and copy the script bellow and paste it into the actions panel.
var pc = 0;
this.onEnterFrame = function(){
pc = Math.floor((_root.getBytesLoaded() /_root.getBytesTotal()) *100);
this.bar._xscale = pc;
if (pc == 100 && !isNAN(pc)){
delete this.onEnterFrame;
_root.play()
}
}
Now lock that layer, we are now going to the "Preloader" layer. Make a 350 by 20 rectangle with a stroke using the rectangle tool (If you have Adobe Flash CS3, press "O" on your keyboard to select the oval tool and "R" for the rectangle tool). Now, click the filling of the rectangle that you made, and convert it into a movieclip (Press "F8" and select movieclip). Give the filling a instance name called bar. Make a new scene and make your movie or game but I want you to find a big picture that you can find on Google and paste it in the scene. Now to test it, click control > Test Movie > View > Download Settings > DSL. You are now done!
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
At 2/11/09 02:40 PM, robocopisback wrote: Have you ever had a problem when you want to submit a game or movie on Newgrounds.com? Your file is to big when Newgrounds.com can only take a 10mb. That is why you make a preloader for your game or movie so that the site doesn't have to download it. All the preloader does is downloads the movie or game for you to watch it.
Eh? This doesn't make sense. A preloader doesn't shrink the size of your swf, and if you're talking about loading a movie into a shell, that's a whole different bunch of AS. Besides, chances are that if the filesize is over 10mb, it means the game or movie hasn't been compressed or optimised well enough
if (pc == 100 && !isNAN(pc)){
if(pc>=100){ would do the job, not sure why you're bothering to check for isNAN
- roojames
-
roojames
- Member since: Oct. 29, 2008
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
Any preloader made with such simplicity would be piss poor. Downloading a Newgrounds loader is quicker, easier and looks a gazzilion times better, and if you really want something personalized, just edit an existing one. That's how I do preloaders, and I don't know the first thing about AS.
- robocopisback
-
robocopisback
- Member since: Jul. 26, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
Okay, I know my description sucks but it is so hard to explain.
- roojames
-
roojames
- Member since: Oct. 29, 2008
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
At 2/12/09 12:07 AM, robocopisback wrote: Okay, I know my description sucks but it is so hard to explain.
Sorry if I was a little harsh...
Tutorials like this are usually much better in video form.
- robocopisback
-
robocopisback
- Member since: Jul. 26, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
Okay, I will upload a video that I uploaded a in one of my blogs on Newgrounds. I will give you guys a link.
- roojames
-
roojames
- Member since: Oct. 29, 2008
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate



