Created
April 3, 2009 21:30
-
-
Save etrepum/89981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Main.swf: Main.as | |
mxmlc -use-network -default-size 600 600 Main.as | |
*/ | |
package{ | |
import flash.display.*; | |
import flash.text.*; | |
import flash.events.*; | |
import mochi.as3.*; | |
public dynamic class Main extends Sprite | |
{ | |
private var mytext:TextField = new TextField; | |
public function Main():void | |
{ | |
Init(); | |
} | |
private function Init():void | |
{ | |
stage.frameRate = 33; | |
stage.addEventListener(Event.ENTER_FRAME, AdLoop); | |
stage.addChild(mytext); | |
StartAd(); | |
} | |
private function StartAd():void | |
{ | |
mytext.text = "Ad starting."; | |
MochiAd.showPreGameAd( { id:"test", res:"600x600", clip:this, ad_finished:CloseAd, ad_started:function ():void { trace("Ad Started!"); } } ); | |
} | |
private function CloseAd():void | |
{ | |
trace("Ad Finished!"); | |
stage.removeEventListener(Event.ENTER_FRAME, AdLoop); | |
mytext.text = "Ad has finsihed."; | |
StartGame(); | |
} | |
private function AdLoop(e:Event):void | |
{ | |
// nothing to see here | |
} | |
private function StartGame():void | |
{ | |
stage.addEventListener(Event.ENTER_FRAME, MainLoop); | |
} | |
private function MainLoop(e:Event):void | |
{ | |
// nothing to see here | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment