Skip to content

Instantly share code, notes, and snippets.

@keyle
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save keyle/b1d5254b3c43d2dbf79c to your computer and use it in GitHub Desktop.

Select an option

Save keyle/b1d5254b3c43d2dbf79c to your computer and use it in GitHub Desktop.
Parsley 3.0 in AS3 only - NO XML
package
{
import org.spicefactory.parsley.context.ContextBuilder;
import org.spicefactory.parsley.core.context.Context;
public class ParsleyContext
{
public static var context:Context;
public static function init():void
{
var factory:Object = new DefaultLogFactory();
factory.setRootLogLevel(LogLevel.WARN);
LogContext.factory = factory as LogFactory; // Turn off default [INFO] logging
context = ContextBuilder.newBuilder()
.object(new Player())
.object(new Model())
.build();
}
}
}
package
{
public class Model
{
public var test:Array = ["hello", "world"];
}
public class Player
{
[Inject]
public var model:Model;
[Init]
public function Init():void
{
trace(model.test);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment