package com.arc.dh.state { import com.arc.dh.util.Config; import flash.display.Loader; import flash.events.Event; import flash.events.MouseEvent; import flash.media.SoundMixer; import flash.system.ApplicationDomain; import flash.system.LoaderContext; import org.flixel.FlxG; import org.flixel.FlxState; import org.flixel.FlxU; public class Pegas extends FlxState { private static var AG:Class = Pegas_AG; private var len:Number = Config.DEBUG ? 0 : 330; private var zoomFactor:int = 1; private var movie:Loader; private var _clicked:Boolean = false; public function Pegas() { super(); } override public function create() : void { FlxG.bgColor = 4281545523; this.movie = new Loader(); var _loc1_:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain); this.movie.loadBytes(new AG(),_loc1_); this.movie.contentLoaderInfo.addEventListener(Event.COMPLETE,this.contentsRetrieve); FlxG.stage.addEventListener(MouseEvent.CLICK,this.pegasSplash); } private function pegasSplash(param1:*) : void { if(!this._clicked) { FlxU.openURL("http://www.pegasgames.com/"); this._clicked = true; this.len = 10; } } override public function update() : void { super.update(); } private function contentsRetrieve(param1:Event) : void { this.movie.scaleX = 1 / this.zoomFactor; this.movie.scaleY = 1 / this.zoomFactor; this.movie.x = (FlxG.width * 2 - 550) / 2; this.movie.y = (FlxG.height * 2 - 400) / 2; this.movie.opaqueBackground = 3355443; FlxG.stage.addChildAt(this.movie,0); this.movie.addEventListener(Event.EXIT_FRAME,this.next); } private function next(param1:Event) : void { --this.len; if(this.len <= 0) { FlxG.stage.removeChildAt(0); SoundMixer.stopAll(); this.movie.removeEventListener(Event.EXIT_FRAME,this.next); this.movie.unload(); FlxG.stage.removeEventListener(MouseEvent.CLICK,this.pegasSplash); FlxG.switchState(new MainMenu()); } } } }