
Код AS3:
package
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.utils.getDefinitionByName;
/**
* ...
* @author
*/
public class PreloaderClass extends MovieClip
{
public function PreloaderClass()
{
//----------------------------------------------------------------------
if (stage)
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
}
//----------------------------------------------------------------------
addEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
//----------------------------------------------------------------------
// TODO show loader
//----------------------------------------------------------------------
}
private function ioError(e: IOErrorEvent): void
{
//----------------------------------------------------------------------
trace(e.text);
//----------------------------------------------------------------------
}
private function progress(e: ProgressEvent): void
{
//----------------------------------------------------------------------
// TODO update loader
//----------------------------------------------------------------------
}
private function checkFrame(e: Event): void
{
//----------------------------------------------------------------------
if (currentFrame == totalFrames)
{
stop();
loadingFinished();
}
//----------------------------------------------------------------------
}
private function loadingFinished(): void
{
//----------------------------------------------------------------------
removeEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, ioError);
//----------------------------------------------------------------------
// TODO hide loader
//----------------------------------------------------------------------
startUP();
//----------------------------------------------------------------------
}
private function startUP(): void
{
//----------------------------------------------------------------------
var mainClass: Class = getDefinitionByName("MainClass") as Class;
addChild(new mainClass() as MovieClip);
//----------------------------------------------------------------------
}
}
}
чёт не пойму и чем же от моего отличается ?

Код AS3:
package app
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.utils.ByteArray;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.text.TextField;
/**
* ...
* @author
*/
public class cPreloader extends Sprite
{
public var appLoaded: Boolean = false;
public function cPreloader()
{
//----------------------------------------------------------------------
if (stage) Initialization()
else addEventListener(Event.ADDED_TO_STAGE, Initialization);
//----------------------------------------------------------------------
}
private function Initialization(e: Event = null): void
{
//----------------------------------------------------------------------
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
removeEventListener(Event.ADDED_TO_STAGE, Initialization);
//----------------------------------------------------------------------
}
private function progress(e: ProgressEvent): void
{
//----------------------------------------------------------------------
if (e.bytesLoaded == e.bytesTotal)
{
appLoaded = true;
parentInstance.startApp();
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, ioError);
}
//----------------------------------------------------------------------
}
private function ioError(e: IOErrorEvent): void
{
//----------------------------------------------------------------------
//errorText.text = String(e);
//----------------------------------------------------------------------
}
}
}
немного изменил а так тож самое