Circle Preloader

Get Adobe Flash player

Here’s a nice little circle pre-loader class created recently. All you really need to do is add it to the stage and then update its percent value (between 0 and 1) on a ProgressEvent or whatever event you want really. There are also two optional values that you can set in the constructer which relate to the colour of the loader.

You can download the source here

?View Code ACTIONSCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
import flash.events.ProgressEvent;
import net.peteshand.utils.CirclePercentLoader;
 
var circlePercentLoader:CirclePercentLoader = new CirclePercentLoader(0xAAAAAA, 0x666666);
circlePercentLoader.x = stage.stageWidth/2;
circlePercentLoader.y = stage.stageHeight/2;
addChild(circlePercentLoader);
 
loaderInfo.addEventListener(ProgressEvent.PROGRESS, OnProgress);
function OnProgress(event:ProgressEvent):void
{
     circlePercentLoader.percent = loaderInfo.bytesLoaded/loaderInfo.bytesTotal;
}

Submit a Comment

Your email address will not be published. Required fields are marked *