MultiPreloader

Package:
Class:
Inheritance:
biz.flashscript.utils
public class MultiPreloader
Sprite
The MultiPreloader class allows to preload several objects at one time but shows only one preload event. When preloading is completed an event is dispatched. The MovieClip will have a stop(); method in frame 1. To initiate the MultiPreloader use the constructor new MultiPreloader() and add parameters.

See also

   biz.flashscript.components.preloader.Preloader

   biz.flashscript.utils.MultiPreloader

Public Properties
Property Defined By
All inherited properties of the Sprite class. N/A
Public Methods
Method Defined By
MultiPreloader(myArray:Array, _path:String="", myColor:uint=0x000000)
Constructor
MultiPreloader
Events
Event Defined By

loadComplete

This event is dispatched when preloading is completed.

MultiPreloader
All inherited events for the Sprite class. N/A
Constructor Detail
MultiPreloader ()  Constructor
public function MultiPreloader(myArray:Array, _path:String="", myColor:uint=0x000000)
Intializes a new MultiPreloader instance.
Method Detail
MultiPreloader ()  Constructor
public function MultiPreloader(myArray:Array, _path:String="", myColor:uint=0x000000)
Intializes a new MultiPreloader instance.

Parameters

  • myArray:Array ____ An array with the name or path of the objects.
  • _path:String ____ The path to the objects to preload.
  • myColor:uint ____ Optional: The color for the text. Default is 0x000000.
Event Detail

loadComplete event

Event Object Type: biz.flashscript.utils.MultiPreloader
Event.type property = biz.flashscript.utils.MultiPreloader.LOAD_COMPLETE

Dispatched when preloading is completed.

Examples
Create a new fla file and name it Multipreloader.fla. Place the fla in the same folder as the biz folder. You need to have a folder "images" with several images inside. Then create an Actionscript file, name it Multipreloader.as and place this script. Change the names of the images accordingly.
package 
{
	import flash.display.*;
	import flash.events.Event;
	import biz.flashscript.utils.MultiPreloader;

	public class Multipreloader extends Sprite
	{
		public function Multipreloader ():void
		{
			var myArray:Array = new Array("1367976.jpg","1367976.jpg","1368580.jpg","1368732.jpg","1369844.jpg","1370120.jpg","1370122.jpg","1370126.jpg","1370132.jpg");
			var mp:MultiPreloader = new MultiPreloader(myArray,"images/");
			addChild (mp);
			mp.addEventListener ("loadComplete",onComplete);
		}
		private function onComplete (e:Event):void
		{
			var mp:DisplayObjectContainer = e.currentTarget as DisplayObjectContainer;
			//removeChild (mp);//remove after loading
			trace("exit");
		}
	}
}