Created
September 3, 2010 06:05
-
-
Save JasonDias/563484 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
package | |
{ | |
import flash.events.Event; | |
public class FlarManagerEvent extends Event | |
{ | |
public static const READY:String = "FlarManagerEvent.READY"; | |
public function FlarManagerEvent( type:String, bubbles:Boolean = false, cancelable:Boolean = false ) | |
{ | |
super( type, bubbles, cancelable ); | |
} | |
public override function clone():Event | |
{ | |
return new FlarManagerEvent( type, bubbles, cancelable ); | |
} | |
public override function toString():String | |
{ | |
return formatToString( "FlarManagerEvent", "type", "bubbles", "cancelable", "eventPhase" ); | |
} | |
} | |
} |
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
package | |
{ | |
import org.robotlegs.mvcs.Mediator; | |
public class FlarManagerMediator extends Mediator | |
{ | |
[Inject] | |
public var view:FlarManagerView; | |
override public function onRegister():void | |
{ | |
eventMap.mapEvent(view, FlarManagerEvent.READY, dispatch); // here I just want to pass the event along to the framework. | |
// eventMap.mapEvent(view, FlarManagerEvent.READY, handleFlarManagerReady); // here I just want to intercept and handle the event. | |
view.startup(); | |
} | |
} | |
} |
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
package | |
{ | |
import flash.display.Sprite; | |
import flash.events.Event; | |
public class FlarManagerView extends Sprite | |
{ | |
private var _flarManager:FLARManager; | |
public function FlarManagerView() | |
{ | |
trace('FlarManagerView'); | |
} | |
public function startup():void | |
{ | |
_flarManager = new FLARManager("Assets/XML/flarConfig.xml", new FLARToolkitManager(), this.stage); | |
_flarManager.addEventListener(Event.INIT, onFlarManagerReady); | |
addChild(Sprite(flarManager.flarSource)); | |
} | |
private function onFlarManagerReady( event:Event ):void | |
{ | |
dispatchEvent(new FlarManagerEvent(FlarManager.READY)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment