Skip to content

Instantly share code, notes, and snippets.

View Stray's full-sized avatar

Stray Stray

  • Innerleithen, Scotland
View GitHub Profile
@Stray
Stray / MediatorThatNeedsData.as
Created November 5, 2010 17:50
Workaround for timing issues with onRegister / data providing events
[Inject]
public function set requestScreenDataSyncSignalPair(signal:RequestScreenDataSyncSignalPair):void
{
_requestScreenDataSyncSignalPair = signal;
}
override public function onRegister():void
{
eventMap.mapListener(eventDispatcher, UserDataSetEvent.DATA_SET_UPDATED, dataSetUpdatedHandler);
private function isACommand(commandClazz:Class):Boolean
{
if(describeType(commandClazz).factory.method.(@name == "execute").length() > 0)
{
return true;
}
return false;
}
@Stray
Stray / ICompoundInterface.as
Created October 21, 2010 12:47
I had hoped that the compiler/AVM might be able to infer that the interface is valid.
public interface ICompoundInterface extends IDrawable, IEdible
{
}
public class SomethingConcrete implements IDrawable, IEdible
{
}
// throws type conversion error
var concreteThing:ICompoundInterface = ICompoundInterface(new SomethingConcrete());
public class WarnIfCurrentEditDataIsChangedCommand extends Command
{
[Inject]
public var getEditedVOSignalResponsePair:GetEditedVOSignalResponsePair;
[Inject]
public var editingModel:IEditingModel;
[Inject]
public var dataChangeEvent:AdminDataEvent;
@Stray
Stray / AccountDataLoadingService.as
Created October 18, 2010 14:55
Interface for loading services
public class AccountDataLoadingService extends AdminDataLoadingService {
public function AccountDataLoadingService()
{
_loadingDataVOType = AccountDataVO;
super();
}
override protected function processLoadedData(urlVars:URLVariables):void
@Stray
Stray / SomeClassA.as
Created October 15, 2010 14:54
Code implementing an isNot(c:Class):Boolean function on the Object prototype
package com.newloop.experiments.isnot {
public class SomeClassA extends SomeClassB {
public function SomeClassA() {
}
}
}
// This causes repeated test running:
override public function run():void{
var mockolateMaker:IEventDispatcher = prepare(Sprite);
mockolateMaker.addEventListener(Event.COMPLETE, prepareCompleteHandler, false, 0, true);
}
private function prepareCompleteHandler(e:Event):void{
super.run();
}
// I started to notice that my test count was increasing exponentially.
// So I placed a trace in the 'startTest' func of asunit.framework.TestResult (line 120)
public function startTest(test:Test):void {
var count:int = test.countTestCases();
fRunTests += count;
trace("startTest: " + test + " => " + count + " : " + fRunTests);
package
{
import flash.display.MovieClip;
public class FrameScriptManager extends Object
{
private var _targetMC:MovieClip;
private var _frameNumbersToFunctionsArray:Array;
public function FrameScriptManager(targetMC:MovieClip)
package app.restricted.view.overlays {
import asunit.framework.TestCase;
import org.robotlegs.mvcs.Mediator;
import mockolate.prepare;
import mockolate.nice;
import mockolate.stub;
import mockolate.verify;