Skip to content

Instantly share code, notes, and snippets.

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 = "")
{
@dannykopping
dannykopping / xmlToObject.as
Created November 5, 2010 22:18
Deserialize XML to an Object instance
private function xmlToObject(xml:XML, chain:Object=null):Object
{
if(!chain)
chain = {};
for each(var child:XML in xml.children())
{
(child.children().length() > 1 || (child.children().length() == 1 && child.hasComplexContent()))
? chain[child.name().toString()] = xmlToObject(child, chain[child.name().toString()])
: chain[child.name().toString()] = chain[child.name().toString()] = child.text().toString();
@destroytoday
destroytoday / gist:737905
Created December 12, 2010 07:26
Static constructor
package com.destroytoday.example
{
public class StaticClass
{
{ trace('constructed'); } // <-- static constructor
}
}
@abeldebeer
abeldebeer / IGuardedSignalCommandMap & GuardedSignalCommandMap
Created December 16, 2010 16:09
AS3Signals implementation of @stray_and_ruby's GuardedCommandMap (first, untested version)
package org.robotlegs.core
{
import org.osflash.signals.ISignal;
/**
* @author Abel de Beer
*/
public interface IGuardedSignalCommandMap
{
function mapGuardedSignal(signal:ISignal, commandClass:Class, guards:*, oneShot:Boolean = false):void;
@claus
claus / PNGPacker.as
Created June 8, 2011 18:04
Create SWF with PNGs
package
{
// Dependencies:
// as3swf.swc
// as3commons-bytecode-1.0-RC1.swc
// as3commons-lang-0.3.2.swc
// as3commons-logging-2.0.swc
// as3commons-reflect-1.3.4.swc
// MinimalComps_0_9_9.swc
@inspirit
inspirit / LList.as
Created June 19, 2011 16:56
Fast & Simple Dual Linked List
package ru.inspirit.asfeat.struct
{
/**
* Simple but fast Dual Linked List approach
* Core implementation idea grabbed from Linux Kernel C source
*
* @author Eugene Zatepyakin
*/
public final class LList
{
@alecmce
alecmce / robotlegs_strategies.as
Created July 31, 2011 16:26
strategies for mapping values and executing commands in RobotLegs
1. github.com/robotlegs/robotlegs-framework/blob/master/src/org/robotlegs/base/CommandMap.as:
// only one mapping possible
mapValues();
command = createCommand(mapping);
unmapValues();
command.execute();
2. github.com/joelhooks/signals-extensions-CommandSignal/blob/master/src/org/robotlegs/base/SignalCommandMap.as:
@neilmanuell
neilmanuell / A) StateConfiguration.as
Last active September 27, 2015 13:37
AS3 API for TryHarderStateMachine
fsm
.configureState( StateNames.HAPPINESS )
.withEntryGuards( OnlyIfHappy, OnlyIfSmiling )
.withExitiGuards( OnlyIfAnxious )
.withTargets( StateNames.SADNESS, StateNames.ECSTACY );
package org.devboy;
import haxe.macro.Type;
import neko.Lib;
import haxe.macro.Expr;
import haxe.macro.Context;
class Funk
{
@flarb
flarb / AssetGPULoader.cs
Created July 22, 2012 19:06
Unity3d GPU Pre-loader
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
public class AssetGPULoader : MonoBehaviour {
public Camera activeCamera;
RenderTexture _rt;