Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
public class ViewPrepCommand extends SimpleCommand { override public function execute( note : INotification ) : void { trace("view preparation command "+note.getBody() as Main) facade.registerMediator( new StageMediator( note.getBody() as Main ) ); //sendNotification(LandedFacade.STAGE_MEDIATOR_CREATED); } }
public function StageMediator(viewComponent:Main) { super(NAME, viewComponent); trace("stage mediator ",viewComponent ) fv = new FlashVarsVo(stage); // - something passed in which is null when traced at other end var twidth:String=fv.getVar("_width") // - causing the error } /** * Retrieves the viewComponent and casting it to type Stage */ public function get stage():Stage { return viewComponent as Stage; }
public function StageMediator(viewComponent:Main) { super(NAME, viewComponent); trace(stage,viewComponent) } /** * Retrieves the viewComponent and casting it to type Stage */ public function get stage():Stage { return viewComponent as Stage; }
/** * Cast the viewComponent to its actual type. * * <P> * This is a useful idiom for mediators. The * PureMVC Mediator class defines a viewComponent * property of type Object. </P> * * <P> * Here, we cast the generic viewComponent to * its actual type in a protected mode. This * retains encapsulation, while allowing the instance * (and subclassed instance) access to a * strongly typed reference with a meaningful * name.</P> * * @return app the viewComponent cast to CafeTownsend */ protected function get app():CafeTownsend { return viewComponent as CafeTownsend }
public function StageMediator(viewComponent:Object) { super(NAME, viewComponent); fv = new FlashVarsVo(app.stage); key=fv.getVar("key") init(); } private function init():void { MAPBASE = new UIComponent(); app.addChild(MAPBASE); m = new MapView() MAPBASE.addChild(m) m.width = 100 m.height=100 } /* * @return app the viewComponent cast to CafeTownsend */ protected function get app():Main { return viewComponent as Main }