This Blog contains About Action script 3.0 Variables, Data types, Access specifies, Keywords, Operators, Conditional statements, Control statements, Arrays (Indexed, Associative, Multidimensional, Cloning), Functions, Symbols, Movie clips (Transformation point, Registration point, Loading images), Buttons, Events (Key board, Mouse, Timer, XML)Pre- defined function :- Random, Hit test object, Drag and drop, Sort, Loader, Tween,URL Loader, Video components, Audio Components, Sound Channel.
Monday, 21 July 2014
as3-preloader classes
import flash.events.ProgressEvent;
stop();
// progress event
loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingProgress);
loaderInfo.addEventListener( Event.COMPLETE , finishedLoading );
// simple preloader;
function loadingProgress(e:ProgressEvent):void
{
preloaderBar.scaleX = loaderInfo.bytesLoaded / loaderInfo.bytesTotal;
}
function finishedLoading( evt:Event ):void
{
loaderInfo.removeEventListener( Event.COMPLETE , finishedLoading );
gotoAndStop(2);
}
// if you are using classes code you can use ProgressEvent in timeline and use Event.COMPLETE in classes ( Main.as )
But you have to remember several thing .....
1. you should load your pre-loader animation in frame 1
2. Should change Advanced ActionScript Settings => Export Classes in frames 2 ( frame 2)
Check below fig. for more info.......
stop();
// progress event
loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingProgress);
loaderInfo.addEventListener( Event.COMPLETE , finishedLoading );
// simple preloader;
function loadingProgress(e:ProgressEvent):void
{
preloaderBar.scaleX = loaderInfo.bytesLoaded / loaderInfo.bytesTotal;
}
function finishedLoading( evt:Event ):void
{
loaderInfo.removeEventListener( Event.COMPLETE , finishedLoading );
gotoAndStop(2);
}
// if you are using classes code you can use ProgressEvent in timeline and use Event.COMPLETE in classes ( Main.as )
But you have to remember several thing .....
1. you should load your pre-loader animation in frame 1
2. Should change Advanced ActionScript Settings => Export Classes in frames 2 ( frame 2)
Check below fig. for more info.......
Subscribe to:
Posts (Atom)