Web Development Logs
Find articles, news and reviews about latest technologies.


Welcome Guest !
please login or register a new free account.


Home | Archives | Submit Article | Top Rated | Advance Search | Contacts Us | Rss Feeds

    Main Categories
» Free downloads
» General Blog
» Google Adsense
» Scripting languages
» Search Engines
» Web Designing

  More Options
» Most read articles
» Most rated articles

   Subscription
Subscribe now and receive free articles and updates instantly.
» Your name » Your Email

titles description    advance search
Published : April 29, 2006 | Author : Ali Roman
Category : Scripting languages | Total Views : 6110 | Rating :

  
This tutorial will demonstrate how to make a simple percentage preloader for your SWiSHMAX Movies.

Level : Intermediate
French Transalation here - Thanks to Pierre

Preview Example



We will use a function percentLoaded(); in this tutorial, to get the percentage of the movie loaded.

Description
------------
This function returns the percent of the movie that has so far loaded into your temporary file folder, its possible values are from 0 to 100. It always returs an integer value (means there will be no vlaue with point as 21.4 or 34.5, it will  always return a round vlaue as 21 or 34. So its really handy function because this way we can let our movie goto any Frame number.

I assume that you already know how to make a simple preloader for your movies. You  will have to make two scences, in the first scene (will be will at the top) you will place your percenatge preloader and in the next scene (Scene 2) you will place your movie to be loaded(main movie)..

Ok - follow the steps now.

1. In this step we will make the designing part how our percentage preloader will look like. Put some static text "Movie Loaded :" in Scene_1.

2. Make a dynamic TEXT box and on the its properties NAME, put per infront of it. It means per is the object name of your dynamic text box. Check the Target and give Variable name as percent.

3. Make BAR which you want to dusplay while loading movie, I have made a simple bar with Radial Gradient property. Convert it to sprite bar. Now reduce the width of bar to 2 pixels, so it will look like this.

user posted image

Ok - now in your bar sprite place a Stop() action on frame number 1. Place a move
effect of 100 Frames in front of your Bar, and stretch it how big bar you want, Just like this

user posted image

4. On frame number 1 of Scene (preloader) paste the following code

onEnterFrame() {
        myVar = percentLoaded();
        percent = myVar+"%";
        tellTarget (bar) {
            gotoAndStop(myVar);
        }
       if (myVar >= 100) {
         gotoSceneAndPlay("Scene_2",2);
      }
}

onFrame (2) {
    prevFrameAndPlay();
}

so your movie will look like

user posted image

Explaination of Above Code.
----------------------------
myVar = percentLoaded();

In this line the number which is returned by percentLoaded() function in saved in variable name myVar. So that we can further use this myVar anywhere.

percent = myVar+"%";
As we know percent is our dynamic text box, in this line we are displaying the percentage of movie downlaoded.

tellTarget (bar) {
    gotoAndStop(myVar);
}


In the above code we are goign to next frames of BAR sprite in which our bar is placed.

if (myVar >= 100) {
    gotoSceneAndPlay("Scene_2",1);
}

In the above code we are putting a condition that if movie is 100% loaded then goto SCENE2 (where
your main movie in placed) and Play. You can put any action you want after your movie is downloaded.

5. Insert Scene_2, and place you graphics there. So that it will be redirected to Scene 2 after your movie is 100% loaded.

You are DONE !..

Dont forget to Export your Movie with Flash Player 6. Goto Export tab,
SWF version to export : SWF6


Download Example File

I hope its very easy to understand. But still if you have problems, or questions. Please feel free to post.

best regards
Ali Roman...




1 2 3 4 5
please rate this article     Poor
Excellent    
Most viewed articles in Scripting languages category

Retrieving data from MySQL database using php
Creating simple contact form using swishmax and php
Creating dynamic combo list with PHP and MySQL
Creating simple percentage preloader with swishmax
Saving data to a text file with swishmax and php
Most recent articles in Scripting languages category

Saving data to a text file with swishmax and php
Creating dynamic combo list with PHP and MySQL
Retrieving data from MySQL database using php
Establishing connection with MySQL using php
Creating table using MySQL database

 Visitor's Comments !

there are no comments...


    Random Pick
Well thats pretty old :) but still I guess may be it will help someone so reposting it here, its bascially the publish settings in flash to get best image resolution.

    Statistics
» Total Articles
72
» Total Authors
96
» Total Views
116337
» Total categories
6

Delete cookies set by this site | Top   

Article Manager by Flaxweb
Copyright 2006 © Flax Article Manager v1.1