Section 1
//NGLoader (NGLoader)
package {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.net.*;
public dynamic class NGLoader extends MovieClip {
public const AUTO_PLAY:Boolean = false;
public var bar:MovieClip;
public var ngButton:SimpleButton;
public var playButton:SimpleButton;
public var loadingComplete:Boolean;
public var initialized:Boolean;
public function NGLoader(){
addFrameScript(0, frame1, 1, frame2);
}
public function init():void{
if (initialized){
return;
};
initialized = true;
stop();
if (((root) && ((root is MovieClip)))){
MovieClip(root).stop();
};
loadingComplete = false;
ngButton.addEventListener(MouseEvent.CLICK, ngButtonClickHandler, false, 0, true);
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
if (meetsVersion([9, 0, 28, 0])){
addEventListener(Event.REMOVED_FROM_STAGE, cleanup, false, 0, true);
};
enterFrameHandler();
}
public function enterFrameHandler(_arg1:Event=null):void{
var _local2:Number;
if (!loadingComplete){
_local2 = 0;
if (loaderInfo){
_local2 = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
};
if (bar){
bar.scaleX = _local2;
};
if (_local2 == 1){
loadingComplete = true;
if (AUTO_PLAY){
startMovie();
} else {
gotoAndPlay("loaded");
};
};
};
}
public function meetsVersion(_arg1:Array):Boolean{
var _local2:Array;
var _local3:uint;
_local2 = String(Capabilities.version.split(" ")[1]).split(",");
_local3 = 0;
while (_local3 < _arg1.length) {
if (uint(_local2[_local3]) > _arg1[_local3]){
return (true);
};
if (uint(_local2[_local3]) < _arg1[_local3]){
return (false);
};
_local3++;
};
return (true);
}
public function playButtonClickHandler(_arg1:Event=null):void{
startMovie();
}
function frame1(){
initialized = false;
init();
}
function frame2(){
stop();
if (((playButton) && (!(playButton.hasEventListener(MouseEvent.CLICK))))){
playButton.addEventListener(MouseEvent.CLICK, playButtonClickHandler, false, 0, true);
};
}
public function ngButtonClickHandler(_arg1:Event):void{
navigateToURL(new URLRequest("http://www.newgrounds.com"), "_blank");
}
public function cleanup(_arg1:Event=null){
if (initialized){
ngButton.removeEventListener(MouseEvent.CLICK, ngButtonClickHandler);
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
if (meetsVersion([9, 0, 28, 0])){
removeEventListener(Event.REMOVED_FROM_STAGE, cleanup);
};
};
initialized = false;
}
public function startMovie():void{
cleanup();
if (((root) && ((root is MovieClip)))){
MovieClip(root).play();
};
dispatchEvent(new Event(Event.COMPLETE));
}
}
}//package