Created
November 8, 2011 21:51
-
-
Save JesterXL/1349370 to your computer and use it in GitHub Desktop.
Robotlegs Mediator without a view reference
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.Graphics; | |
import flash.display.Sprite; | |
public class Box extends Sprite | |
{ | |
public function Box() | |
{ | |
super(); | |
draw(0x000000); | |
} | |
public function draw(color:uint):void | |
{ | |
var g:Graphics = graphics; | |
g.clear(); | |
g.beginFill(color); | |
g.drawRect(0, 0, 100, 100); | |
g.endFill(); | |
} | |
} | |
} |
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 BoxMediator extends Mediator | |
{ | |
public function BoxMediator() | |
{ | |
super(); | |
} | |
public override function onRegister():void | |
{ | |
super.onRegister(); | |
trace("view: ", this.viewComponent); | |
} | |
} | |
} |
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.DisplayObjectContainer; | |
import org.robotlegs.mvcs.Context; | |
public class MainContext extends Context | |
{ | |
public function MainContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true) | |
{ | |
super(contextView, autoStartup); | |
} | |
public override function startup():void | |
{ | |
mediatorMap.mapView(Box, BoxMediator); | |
super.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; | |
public class TestingRLMediators extends Sprite | |
{ | |
private var context:MainContext; | |
public function TestingRLMediators() | |
{ | |
context = new MainContext(this); | |
var box:Box = new Box(); | |
addChild(box); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment