Lets waiting...
Code:
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.html.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
public class newVersionDialogMC extends MovieClip
{
public var loadingField:TextField;
public var cancelBt:MovieClip;
public var htmlMask:MovieClip;
public var closeBt:SimpleButton;
public var myVersionText:TextField;
public var scroll:MovieClip;
public var updateVersionText:TextField;
public var upgradeNowBt:MovieClip;
public var htmlHolder:MovieClip;
var myTimer:Object;
var timerCount:Object = 0;
var url:Object;
var loader:Object;
var releaseNotesURL:Object;
public var htmlLoader:Object;
public function newVersionDialogMC()
{
addFrameScript(0, this.frame1);
this.closeBt.addEventListener(MouseEvent.MOUSE_DOWN, this.onCancelHandler);
this.upgradeNowBt.addEventListener(MouseEvent.MOUSE_DOWN, this.onUpgradeNowHandler);
this.cancelBt.addEventListener(MouseEvent.MOUSE_DOWN, this.onCancelHandler);
this.myTimer = new Timer(1000);
this.myTimer.addEventListener(TimerEvent.TIMER, this.timerListener);
this.releaseNotesURL = new URLRequest("http://explaindio.com/v/v2_info.txt");
this.url = new URLRequest("http://explaindio.com/v/v2.txt");
this.loader = new URLLoader();
this.scroll.visible = false;
this.scroll.height = 500;
this.scroll.scrollBar.addEventListener(MouseEvent.MOUSE_DOWN, this.onScrollBarMouseDown);
this.scroll.knob.addEventListener(MouseEvent.MOUSE_DOWN, this.onKnobMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, this.onKnobMouseUp);
this.addEventListener(MouseEvent.MOUSE_WHEEL, this.handleMouseWheel);
this.htmlLoader = new HTMLLoader();
this.htmlLoader.navigateInSystemBrowser = true;
this.htmlLoader.width = 870;
this.htmlLoader.height = 450;
this.htmlLoader.x = 0;
this.htmlLoader.y = 0;
this.htmlHolder.addChild(this.htmlLoader);
this.loadingField.text = "Loading Version Release Notes ... Please Wait";
this.loadingField.visible = false;
this.cancelBt.buttonMode = true;
this.upgradeNowBt.buttonMode = true;
this.cancelBt.mouseChildren = false;
this.upgradeNowBt.mouseChildren = false;
return;
}// end function
public function changeGraphics(param1)
{
if (!param1)
{
this.gotoAndStop(1);
this.cancelBt.gotoAndStop(1);
this.upgradeNowBt.gotoAndStop(1);
}
else
{
this.gotoAndStop(2);
this.cancelBt.gotoAndStop(2);
this.upgradeNowBt.gotoAndStop(2);
}
return;
}// end function
public function handleMouseWheel(param1)
{
if (!this.scroll.visible)
{
return;
}
this.scroll.knob.y = this.scroll.knob.y - 5 * param1.delta;
if (this.scroll.knob.y > this.scroll.scrollBar.y + this.scroll.scrollBar.height - this.scroll.knob.height)
{
this.scroll.knob.y = this.scroll.scrollBar.y + this.scroll.scrollBar.height - this.scroll.knob.height;
}
if (this.scroll.knob.y < this.scroll.scrollBar.y)
{
this.scroll.knob.y = this.scroll.scrollBar.y;
}
this.htmlHolder.y = this.htmlMask.y - this.scroll.knob.y * this.scroll.scaleY / this.scroll.knob.scaleY;
return;
}// end function
public function onScrollBarMouseDown(param1)
{
if (!this.scroll.visible)
{
return;
}
this.scroll.knob.y = this.scroll.scrollBar.y + this.scroll.scrollBar.mouseY - this.scroll.knob.height / 2;
if (this.scroll.knob.y > this.scroll.scrollBar.y + this.scroll.scrollBar.height - this.scroll.knob.height)
{
this.scroll.knob.y = this.scroll.scrollBar.y + this.scroll.scrollBar.height - this.scroll.knob.height;
}
if (this.scroll.knob.y < this.scroll.scrollBar.y)
{
this.scroll.knob.y = this.scroll.scrollBar.y;
}
this.htmlHolder.y = this.htmlMask.y - this.scroll.knob.y * this.scroll.scaleY / this.scroll.knob.scaleY;
return;
}// end function
function onKnobMouseDown(param1)
{
this.scroll.knob.startDrag(false, new Rectangle(0, 0, 0, 450 - this.scroll.knob.height));
addEventListener(Event.ENTER_FRAME, this.onKnobDrag);
return;
}// end function
function onKnobMouseUp(param1)
{
this.scroll.knob.stopDrag();
removeEventListener(Event.ENTER_FRAME, this.onKnobDrag);
return;
}// end function
function onKnobDrag(param1)
{
this.htmlHolder.y = this.htmlMask.y - this.scroll.knob.y * this.scroll.scaleY / this.scroll.knob.scaleY;
return;
}// end function
function timerListener(event:TimerEvent) : void
{
var _loc_2:* = this;
var _loc_3:* = this.timerCount + 1;
_loc_2.timerCount = _loc_3;
if (this.timerCount >= 3)
{
this.myTimer.stop();
this.loader.removeEventListener(Event.COMPLETE, this.loaderComplete);
this.loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler);
this.hideMe();
}
return;
}// end function
public function checkForNewVersion()
{
this.loader.addEventListener(Event.COMPLETE, this.loaderComplete);
this.loader.addEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler);
this.loader.load(this.url);
this.timerCount = 0;
this.myTimer.start();
return;
}// end function
function loaderIOErrorHandler(param1)
{
this.loader.removeEventListener(Event.COMPLETE, this.loaderComplete);
this.loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler);
this.myTimer.stop();
this.hideMe();
return;
}// end function
function loaderComplete(event:Event) : void
{
var _loc_2:* = event.target.data;
this.loader.removeEventListener(Event.COMPLETE, this.loaderComplete);
this.loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler);
this.myTimer.stop();
if (Number(_loc_2) > Number(MovieClip(parent).thisVersion))
{
trace("*** *** New version", _loc_2);
this.myVersionText.text = "Your Version: " + String(MovieClip(parent).thisVersion);
this.updateVersionText.text = "New Version: " + String(_loc_2);
this.loader.addEventListener(Event.COMPLETE, this.loaderComplete2);
this.loader.addEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler2);
this.loader.load(this.releaseNotesURL);
this.timerCount = 0;
this.myTimer.start();
this.loadingField.text = "Loading Version Release Notes ... Please Wait";
this.loadingField.visible = true;
this.showMe();
}
else if (Number(_loc_2) < Number(MovieClip(parent).thisVersion))
{
trace("*** *** You jave the beta version", MovieClip(parent).thisVersion, _loc_2);
this.hideMe();
}
else
{
trace("*** *** Same version", _loc_2);
this.hideMe();
}
return;
}// end function
function loaderIOErrorHandler2(param1)
{
this.loader.removeEventListener(Event.COMPLETE, this.loaderComplete2);
this.loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler2);
this.myTimer.stop();
this.loadingField.text = "Error Loading Version Release Notes";
this.loadingField.visible = true;
this.hideMe();
return;
}// end function
function loaderComplete2(event:Event) : void
{
this.loader.removeEventListener(Event.COMPLETE, this.loaderComplete2);
this.loader.removeEventListener(IOErrorEvent.IO_ERROR, this.loaderIOErrorHandler2);
this.myTimer.stop();
var _loc_2:* = new URLRequest(event.target.data);
this.htmlLoader.addEventListener(Event.COMPLETE, this.onPageLoadComplete);
this.htmlLoader.load(_loc_2);
return;
}// end function
public function onPageLoadComplete(param1)
{
this.loadingField.text = "";
this.loadingField.visible = false;
setChildIndex(this.scroll, (numChildren - 1));
this.htmlLoader.height = this.htmlLoader.contentHeight;
if (this.htmlLoader.contentHeight > this.htmlMask.height)
{
this.scroll.visible = true;
this.scroll.knob.scaleY = this.htmlMask.height / this.htmlLoader.contentHeight;
}
else
{
this.scroll.visible = false;
}
return;
}// end function
public function showMe()
{
MovieClip(parent).setChildIndex(this, (MovieClip(parent).numChildren - 1));
this.visible = true;
return;
}// end function
public function hideMe()
{
this.visible = false;
MovieClip(parent).afterNewVersionCheck();
return;
}// end function
public function onCancelHandler(param1)
{
this.hideMe();
return;
}// end function
public function onUpgradeNowHandler(param1)
{
navigateToURL(new URLRequest("http://explaindio.com/update.html"));
this.hideMe();
return;
}// end function
function frame1()
{
stop();
return;
}// end function
}
}