Choose fontsize:
Welcome, Guest. Please login or register.
Did you miss your activation email?

 

Pages: [1] 2  All   Go Down
  Print  
Author Topic: Preloaders!  (Read 26148 times)
0 Members and 1 Guest are viewing this topic.
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« on: February 10, 2006, 05:17:48 PM »
[h1]Preloaders
Easy[/h1]

Here it is!
<a href="http://graphicaddicts.net/ssj/Preloader/preloader.swf" target="_blank">http://graphicaddicts.net/ssj/Preloader/preloader.swf</a>
Just so you can see it load =]!

Idea
To make a bar stretch to the percentage of the total loaded bytes.  Okay, that’s just the weird way of saying it.  I’m sure you all know what a Preloader is.  You’ve seen them, you use them, and you love them.  But can you make them on your own? If you can, then why are you reading this? If not, then this tutorial is where you want to be!

Need to know
  • Variables
  • Movie Clip Properties (IE: _xscale, _yscale)
  • Basic Action Script
[/color]

Setup
Okay, this is very simple.  Start by making your main timeline have 2 key frames.  Now, on the first keyframe, add this:
Code:
stop();
Just that, and on the frame itself.
Next up, make the preloader!
Start off by drawing the basic preloader outline, here's what mine looks like right now:

Screen Shot

If you notice, that's a dynamic text box.  I converted it to static right after I put the text I want in it.  I used a dynamic text box, because I can size it, and it won't change automatically.

Now, select all of your preloader, and press F8, this will bring up the “Convert to Symbol” menu.  Select Movie Clip, name it whatever you like, for the sake of this tutorial, I named it “Preloader”.

Double click the new Movie Clip to 'go into' it.  Now, you have all your stuff in a new timeline!  There are a few things we need to do from here.  First, let's make a new layer BELOW the current one.  Here, use the rectangle tool and make the bar itself.  I did this because if you look, my preload bar isn't an even square.  This will give it a 'perfect fit' effect:

Screen Shot

Now, I convert that loading bar into a Movie Clip, and I put the 'Registration' option to the left.

Screen Shot

Give that new Movie Clip any instance name, but I will use "bar".

Now, touch up the rest of the preloader, mine ended up like this:

Screen Shot

Here are the Dynamic parts.  Insert a new layer, above the loading bar, but below the preloader graphics. Here's a screen shot of the dynamic text properties:

Screen Shot

Position the text box over the bar, but under the graphics.  I use white, but that's because at the end, the background of the flash will be black, oh, and the instance name can be anything, but I used "pre_info".  Just a bit more to go before I do the scripts! Insert another new layer above all of them.  Now, insert a keyframe in the top layer (for frame 2), a normal frame (F5) in the other three. Now, insert another keyframe in the top layer (frame 3 now), a normal frame in layer 2 (the one with the graphics), a keyframe in layer 3 (with dynamic text), and a normal frame in layer 4(with loading bar).  Confused? Good.  Here's a screen shot of the timeline once you're done:



Now, to fill these frames with what's necessary!
(In accordance with my above screen shot):
Actions layer: Leave Blank for frames 1, 2, and 3
Graphic: Leave the same for 1 and 2, and 3
Text: Leave the same for 1 and 2, but on three, replace it with a 'Play' button. <-- Note that I made a Movie Clip because I'm adding an effect to it.  See this topic to know what I'm doing: Here
Bar: Leave the same for 1, 2, and 3

[/color]
Action Time!
Okay, here's the fun part! Actions! Add this to the first frame in the "Actions" layer:
Code:
per_load = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
pre_info.text = per_load+"% / 100%";
if (per_load != 100) {
bar._xscale = per_load;
} else {
bar._xscale = 100;
gotoAndStop(3);
}
And add this to the second frame:
Code:
gotoAndPlay(1);

Okay, you're wondering what all that is...so here's the part where I explain it bit by bit...but instead of giving it all at once, I'm giving the script as I explain it! So, in this part, I create a loop! It starts off with the
Code:
per_load = Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100);
part.  This is setting the variable "per_load" to the Number of Bytes Loaded, divided by the Total (giving a decimal), then multiplied by 100, making it a percentage! Now, I've also put some Math in there, Math.floor() is round down.  It will, no matter what, round down.  This keeps it even.  Next up is a very east if statement.  saying that if the movie isn't fully loaded, just go on set the _xscale of our "bar" Movie Clip to "per_load" (it's a percentage, and that's how _xscale works, by %!).  And if it is fully loaded, go to frame 3!  Now, this is where the loop comes in.  According to the Movie Clip's auto-play, it will go to the next frame (2), which tells it to go back to 1, and keep playing! See how it loops?

Now, add this to the button on frame 3:

Code:
on (rollOver) {
this.gotoAndStop(2);
}
on (rollOut, dragOut) {
this.gotoAndStop(1);
}
on (press, dragOver) {
this.gotoAndStop(3);
}
on (release) {
_root.play();
}
onClipEvent (enterFrame) {
if (this._currentframe == 1) {
if (this._alpha>50) {
this._alpha--;
}
} else if (this._currentframe>1) {
if (this._alpha<100) {
this._alpha++;
}
}
}
onClipEvent (load){
this.stop();
}
If you remember form before, I explained what this script does in another post.  If you don't want to use it, you don't have to.  Now, go back on the main timeline, go to frame 2, and just draw something.  For the sake of testing the preloader, I imported some music (to keep filesize up).  And, add a "stop();" on frame 2 (main timeline). Well, that's about it, my preloader is at the top.

Oh, as stated in the flash, that’s Long Beach Dub All Stars – Sunny Hours.

If you like this tutorial, please Click Here to register.

Click the link below to download the Flash files for this tutorial.
Note: Music has been removed for the download.
Preloaders FLA
« Last Edit: March 08, 2006, 04:54:55 PM by ssjskipp » Logged
Graphic Moderator
*

Karma: 16
Gender: Male
Posts: 2,181

...


View Profile WWW
« Reply #1 on: February 13, 2006, 03:17:56 AM »
i didnt actually do the tut since it looks long and i have another way to make preloaders but the final result looks  better than the ones i do so ill give it a try when i have some spare time
Logged
Newbie
*

Karma: 0
Posts: 15

Graphic Addicts Member


View Profile
« Reply #2 on: February 13, 2006, 01:18:03 PM »
Looks good.  I'll have to give this one a try when I've got some spare time, as well. 

Thanks!
Logged
Addict
*

Karma: 4
Gender: Male
Posts: 1,313


Hardcore for the RaveRz


View Profile WWW
« Reply #3 on: February 17, 2006, 08:28:31 AM »
dusnt even work :/ sorry m8 loool
Logged
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« Reply #4 on: February 18, 2006, 01:26:29 PM »
dusnt even work :/ sorry m8 loool

Yes...it does =o! If you've seen it once, you have to delete your cache, that's what makes it dl once, then never again.  Also, it has to be a pretty big file if you're to see the download rate...use a dial-up or something to see it, because Comcast is too good XD.
Logged
Addict
*

Karma: 4
Gender: Male
Posts: 1,313


Hardcore for the RaveRz


View Profile WWW
« Reply #5 on: February 22, 2006, 04:34:13 AM »
lol u lost me, i dno wot a cache is...and i dnt have a dial up connection to test it on:/
Logged
Newbie
*

Karma: 0
Posts: 15

Graphic Addicts Member


View Profile
« Reply #6 on: February 23, 2006, 11:13:05 AM »
Your cache is your temporary internet files.  If the preloader was allowed to operate once and you come back for a second look, the preloader isn't necessary because there is nothing to load..  its already saved in your temp files.
Logged
Addict
*

Karma: 4
Gender: Male
Posts: 1,313


Hardcore for the RaveRz


View Profile WWW
« Reply #7 on: February 23, 2006, 12:14:36 PM »
ahhh nice1 m8
Logged
Graphic Moderator
*

Karma: 16
Gender: Male
Posts: 2,181

...


View Profile WWW
« Reply #8 on: February 24, 2006, 12:11:01 AM »
is still seems to load for me everytime and i have broadband Undecided
Logged
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« Reply #9 on: March 08, 2006, 04:56:20 PM »
Then Blitz's broadband pwns yours.
Logged
Administrator
*

Karma: 51
Gender: Male
Posts: 2,638



View Profile WWW
« Reply #10 on: March 08, 2006, 09:48:45 PM »
Broadband doesn't have anything to do with it, the cache is held by your browser. You can edit the size of the cache in your browsers preferences. Change it to 50MB or so...
Logged
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« Reply #11 on: March 08, 2006, 10:05:13 PM »
Good point sketchi, but as you can see from here (mass refresh):
<a href="http://images2.flashkit.com/movies/Applications/Connect_-Joscha_F-260/Connect_-Joscha_F-260.swf" target="_blank">http://images2.flashkit.com/movies/Applications/Connect_-Joscha_F-260/Connect_-Joscha_F-260.swf</a>
Click here for refreshable version
It fluxuates (needed cool word)
Logged
Administrator
*

Karma: 51
Gender: Male
Posts: 2,638



View Profile WWW
« Reply #12 on: March 08, 2006, 10:38:54 PM »
Right, load speed will be different from person to person, but the cache will stop it from loading all together. Though refreshing *should* remove the old cache...
Logged
Graphic Moderator
*

Karma: 16
Gender: Male
Posts: 2,181

...


View Profile WWW
« Reply #13 on: March 08, 2006, 11:53:01 PM »
my cache was already 50mb so i changed it to 75.  it that too much?
Logged
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« Reply #14 on: March 09, 2006, 03:18:37 PM »
depends on how much you want ~~. I have mine at 5000000 Kilobyte (KB)  = 4,882.8125 Megabyte (MB) (about 5,000 MB).  That's also because I have 160 GB Hard Drive, and about 40 GB left... :/
Logged
Pages: [1] 2  All   Go Up
  Print  
 
Jump to:      

Pixel-Designz [ In: 1183 // Out: 2917 ] MickM [ In: 2403 // Out: 2118 ] BioRUST [ In: 2951 // Out: 2428 ] SMF Topsites [ In: 0 // Out: 2021 ] Graphic Addicts Topsites [ In: 2435 // Out: 3389 ] SweDesignz [ In: 865 // Out: 1647 ] Dr. Photoshop [ In: 1301 // Out: 1634 ] cagedflame [ In: 992 // Out: 1381 ]
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Phobos design by Bloc | XHTML | CSS


Google visited last this page Today at 05:32:02 AM