Packagecom.robertpataki.heartcode
Classpublic class ProgressIndicator
InheritanceProgressIndicator Inheritance flash.display.Sprite

A simple preloader animation.

You can use it to

Compatible players:

View the examples



Public Methods
 MethodDefined By
  
ProgressIndicator(shape:String, density:uint, range:Number, color:Number, radius:uint, frequency:Number, fade:Boolean)
Creates a new preloader animation.
ProgressIndicator
  
kill():void
Kills the preloader.
ProgressIndicator
Public Constants
 ConstantDefined By
  DEFAULT_COLOR : Number = 0x666666
[static]
ProgressIndicator
  DEFAULT_DENSITY : uint = 12
[static]
ProgressIndicator
  DEFAULT_FADE : Boolean = false
[static]
ProgressIndicator
  DEFAULT_FREQUENCY : Number = 0.05
[static]
ProgressIndicator
  DEFAULT_RADIUS : uint = 14
[static]
ProgressIndicator
  DEFAULT_RANGE : Number = 0.8
[static]
ProgressIndicator
  DEFAULT_SHAPE : String = ellipse
[static]
ProgressIndicator
  SHAPE_CIRCLE : String = circle
[static]
ProgressIndicator
  SHAPE_ELLIPSE : String = ellipse
[static]
ProgressIndicator
  SHAPE_SQUARE : String = square
[static]
ProgressIndicator
  SHAPE_STAKE : String = stake
[static]
ProgressIndicator
  SHAPE_TRIANGLE : String = triangle
[static]
ProgressIndicator
Constructor Detail
ProgressIndicator()Constructor
public function ProgressIndicator(shape:String, density:uint, range:Number, color:Number, radius:uint, frequency:Number, fade:Boolean)

Creates a new preloader animation.

Parameters
shape:String (default = NaN) — The shape of the preloader bits. The default value is DEFAULT_SHAPE
 
density:uint (default = NaN) — Sets the fineness of the preloader. The default value is DEFAULT_DENSITY
 
range:Number (default = NaN) — Sets the range of bits to be animated. The default value is DEFAULT_RANGE
 
color:Number (default = NaN) — Sets the color of the preloader. The default value is DEFAULT_COLOR
 
radius:uint (default = NaN) — The radius of the circle the shapes are drawn around. The default value is DEFAULT_RADIUS
 
frequency:Number (default = NaN) — The refreshing frequency of each bit (in seconds). The default value is DEFAULT_FREQUENCY
 
fade:Boolean (default = NaN) — If set to true the non-animated bits of the preloader are invisible. This gives the preloader a nice dynamic look. The default value is DEFAULT_FADE

See also

Method Detail
kill()method
public function kill():void

Kills the preloader.

Constant Detail
DEFAULT_COLORConstant
public static const DEFAULT_COLOR:Number = 0x666666

DEFAULT_DENSITYConstant 
public static const DEFAULT_DENSITY:uint = 12

DEFAULT_FADEConstant 
public static const DEFAULT_FADE:Boolean = false

DEFAULT_FREQUENCYConstant 
public static const DEFAULT_FREQUENCY:Number = 0.05

DEFAULT_RADIUSConstant 
public static const DEFAULT_RADIUS:uint = 14

DEFAULT_RANGEConstant 
public static const DEFAULT_RANGE:Number = 0.8

DEFAULT_SHAPEConstant 
public static const DEFAULT_SHAPE:String = ellipse

SHAPE_CIRCLEConstant 
public static const SHAPE_CIRCLE:String = circle

SHAPE_ELLIPSEConstant 
public static const SHAPE_ELLIPSE:String = ellipse

SHAPE_SQUAREConstant 
public static const SHAPE_SQUARE:String = square

SHAPE_STAKEConstant 
public static const SHAPE_STAKE:String = stake

SHAPE_TRIANGLEConstant 
public static const SHAPE_TRIANGLE:String = triangle

Examples
Example 1: If the constructor is called without parameters it generates a default animation.
     
     
     import com.robertpataki.heartcode.ProgressIndicator;
     
     var preloader_sp:ProgressIndicator = new ProgressIndicator();
     preloader_sp.name = "preloader_sp";
     addChild(preloader_sp);
     preloader_sp.x = stage.stageWidth / 2;
     preloader_sp.y = stage.stageHeight / 2;
     
     
     
     

ProgressIndicator_01.png

Example 2: The simple vector shapes could be much more fancy when some filters are applied.
     
     
     import com.robertpataki.heartcode.ProgressIndicator;
     import flash.filters.BlurFilter;
     import flash.filters.GlowFilter;
     
     var preloader_sp:ProgressIndicator = new ProgressIndicator(ProgressIndicator.SHAPE_CIRCLE, 40, 1, 0x00ffff, 12, 0.03, true);
     preloader_sp.name = "preloader_sp";
     addChild(preloader_sp);
     
     preloader_sp.filters = [new GlowFilter(0x00ffff, 0.6, 8, 8, 2, 2), new BlurFilter(2, 2, 2)];
     preloader_sp.x = stage.stageWidth / 2;
     preloader_sp.y = stage.stageHeight / 2;
     
     
     
     

ProgressIndicator_02.png