You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 6, 2020. It is now read-only.
digitalally edited this page Sep 13, 2010
·
17 revisions
Define your classes
We want a car, and a car needs an engine (sadly):
class Car {
private var engine:LittleEngine;
public function Car(engine:LittleEngine){
this.engine = engine;
}
public function startCar():void {
engine.start();
}
}
Ok, Dawn, Build Me The Car
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="1024" minHeight="768"
creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import uk.co.ziazoo.injector.IInjector;
import uk.co.ziazoo.injector.impl.Injector;
import mx.events.FlexEvent;
protected function creationCompleteHandler(event:FlexEvent):void {
var injector:IInjector = Injector.createInjector()
var car:Car = Car( injector.inject( Car ) );
car.startCar();
}
]]>
</fx:Script>
</s:Application>
Job done… Dawn created our Car, with its LittleEngine… it gets more exciting later on, I promise.