Skip to content

Instantly share code, notes, and snippets.

View darscan's full-sized avatar

Shaun Smith darscan

  • United Kingdom
View GitHub Profile
@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
{
@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
{

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!

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;
}
}
package org.robotlegs.utilities.remote
{
import com.adobe.serializers.json.JSONDecoder;
import mx.collections.ArrayCollection;
public class JsonRemoteService extends RemoteServiceBase
{
public function JsonRemoteService(rootURL:String = "")
{
package com.visfleet.robotlegs {
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import org.robotlegs.base.ContextEvent;
import org.robotlegs.core.IMediatorMap;
import org.robotlegs.mvcs.Actor;
public class Presenter extends Actor {
@darscan
darscan / module_model.php
Created August 2, 2010 15:42
The Worst Code I've Ever Written
<?php
class Module_model extends Model
{
private $log = array();
private $module_row_cache = array();
private $module_field_cache = array();
/**
* Get Module Data and Resolve Dependencies
@darscan
darscan / ruby_fun.rb
Created August 23, 2010 23:07
Some basic Ruby snacks
# Why Ruby is Fun
# Everything is an object
5.times {|x| puts x}
# Even nil is an object
puts nil.nil?
# Yes, nil is an object
nil.methods.each {|x| puts x}
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
121 364 121 364 0 0 201 0 0:00:01 0:00:01 --:--:-- 298
Initialized empty Git repository in [..]
remote: Counting objects: 13228, done.
remote: Compressing objects: 100% (3250/3250), done.
remote: Total 13228 (delta 8712), reused 13116 (delta 8638)
Receiving objects: 100% (13228/13228), 2.35 MiB | 128 KiB/s, done.
Resolving deltas: 100% (8712/8712), done.
@darscan
darscan / ClassWithPrivateInjection.as
Created September 23, 2010 15:26 — forked from troygilbert/ClassWithPrivateInjection.as
private injection from troy
package
{
import private_injection;
class ClassWithPrivateInjection
{
include "inject.include.as";
private var mySecretWord:String;