| Flashscript classes (ActionScript 3) | Home | MX | MX 2004 | Flash 8 | Flash 9 |Flash 10 |PHP |Components | Snippets | Contact | |
Preloader |
|
|
See also
| Property | Defined By |
|---|---|
| All inherited proerties of the Sprite class. | N/A |
| Method | Defined By |
|---|---|
|
Preloader()
Constructor |
Preloader |
|
timelineLoader(target:Object, xPos:int=0, yPos:int=0, nLoaderBar:String=null)
Function to preload a timeline. |
Preloader |
|
imageLoader(target:Object, xPos:int=0, yPos:int=0, nLoaderBar:String=null)
Function to preload external movies and images. |
Preloader |
| Event | Defined By |
|---|---|
|
loadComplete This event is dispatched when preloading is completed. |
Preloader |
| All inherited events for the Sprite class. | N/A |
| Constructor Detail |
|---|
|
Preloader () Constructor
public function Preloader() |
| Intializes a new Preloader instance. |
| Method Detail |
|---|
|
Preloader () Constructor
public function Preloader() |
| Intializes a new Preloader instance. |
|
timelineLoader ():void method public function timelineLoader() |
| Intializes a the loading of the main timeline. |
Parameters
|
|
imageLoader ():void method public function imageLoader() |
| Intializes a the loading of the main timeline. |
Parameters
|
| Event Detail |
|---|
|
loadComplete event
Event Object Type:
biz.flashscript.utils.Preloader
Dispatched when preloading is completed. |
| Examples |
|---|
Create a new fla file and name it Preloader.fla. Place the fla in the same folder as the biz folder. Create a second frame and name it "frame2". Add a 100 frames animation MovieClip in the library and name it "LoaderBar". The have an image in the same folder as the fla file. Then create an Actionscript file, name it Preloaders.as and place this script. Rename the image URL ("image.jpg") in the script. Test movie. The timeline should go to the second frame.
package
{
import flash.display.MovieClip;
import biz.flashscript.utils.Preloader;
import flash.events.*;
public class Preloaders extends MovieClip
{
public function Preloaders ():void
{
var preload:Preloader = new Preloader();
preload.imageLoader("images/a2.jpg",25,100,"LoaderBar");
addChild (preload);
preload.addEventListener (Preloader.LOAD_COMPLETE, completeHandler);
}
private function completeHandler (ev:Event):void
{
trace ("Loading is now complete!");
gotoAndStop ("frame2");
}
}
}
|