Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads | All Downloads

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Swish Templates
   SWiSH Climax
   GimpTalk
   Idea Designs
   Sposatoettore
   Try Acai Berry Diet
   Download Free Ringtones
   Swishzone

Manage your site with Flax Article Content Management System
Preloader (Simple), For standard Site
Category : SWiSHMax | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

So many questions about preloaders and so many examples on the DB but thought do to the over welming questions for it, I would create another.
Script for preloader I got here on the DB some where do not remember where or who created it. Sorry about that.

In your movie create a Scene Name it "Preloader". Make sure this scene is before all others.
Paste this code directly on the main time line of this scene in the script panel.
CODE
onFrame (1) {
   stop();
}
onEnterFrame() {
   myVar = percentLoaded();
   percent = myVar +"%";
   tellTarget (bar) {
       gotoAndStop(myVar);
   }
   if (myVar >= 100) {
       gotoSceneAndStop("Scene_1",1);
   }
}


Create a Sprite and Name it "bar" and make sure to tick the used bottom object as mask.
In the 'bar" place or draw the shapes you want. Move your main shape in here 100 frames and put a stop command on frame "1".
CODE
onFrame (1) {
   stop();
}


Create a Dynamic Text box and name it "percent", place it where you want it on the movie scene.
Create a Static Text box and Put "Loaded" in to it as your text. Place it some where near the "percent", to let users know what is going on.

On Scene_1 if you have nothing playing from the main time line here put a stop action on fram "1".
CODE
onFrame(1){
    stop();
}


If your movie does have animation on the main time line of Scene_1, then change the script on main time line of the preloader to:

CODE
onFrame (1) {
   stop();
}
onEnterFrame() {
   myVar = percentLoaded();
   percent = myVar +"%";
   tellTarget (bar) {
       gotoAndStop(myVar);
   }
   if (myVar >= 100) {
       gotoSceneAndPlay("Scene_1",1);
   }
}


The last part is what you change (The "if" Statement).
Now if you have external movies you are waiting on to load before playing your main movie then this code will need to be modified to suit your needs but works for most movies. Sample attached.
Also remember, you can NOT see the "Preloader" while it is on your computer, it must be uploaded to your server.
Hope this helps.

Download Example


All rights reserved - swish-db.com