Skip to content

Instantly share code, notes, and snippets.

View darscan's full-sized avatar

Shaun Smith darscan

  • United Kingdom
View GitHub Profile
package org.puremvc.as3.multicore.utilities.lazy.interfaces
{
import flash.events.IEventDispatcher;
public interface IFacadeAdapter
{
function getFQCN(clazz:Class):QName;
function startup(eventBus:IEventDispatcher, startupCommandClass:Class = null, autoMediateCommandClass:Class = null):void;
}
}

With automatic mediation waiting for a view component to land on stage is the only way to determine the scope of that view component. When you write “new ViewComp()” there is no way for anyone (other than yourself (a)) to know where that view component is going to end up in the display list hierarchy, and thus no way to determine who should process that view component (which context, and thus, which mediator map).

(a) When manually instantiating the view component you have the opportunity to choose it’s scope sooner:

var vc:ViewComp = new ViewComp();
mediatorMap.createMediator(vc);

As a convenience (and perhaps a hindrance in your case) the mediator waits until the view component is fully initialized before calling onRegister on itself. This “feature” can be found in the mediator’s preRegister hook. If you’d like onRegister to be called sooner (ie immediately), you should override the preRegister hook and call onRegister immediately.

Hope that helps!

@darscan
darscan / PathSpec.as
Created April 28, 2010 22:32
A rough (and bad) AS3 Rich Routing utility
/*
* Copyright (c) 2010 the original author or authors
*
* Permission is hereby granted to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
*/
package org.robotlegs.utilities.routing
{
@darscan
darscan / RobotlegsAsyncCommand.as
Created February 12, 2010 16:16
An Async Command for Robotlegs
package org.robotlegs.extensions.mvcs
{
import flash.utils.Dictionary;
import org.robotlegs.base.EventMap;
import org.robotlegs.core.IEventMap;
import org.robotlegs.mvcs.Command;
public class AsyncCommand extends Command
{