- Flash, Flex, AIR
- Android (Java Mobile Development)
- iPhone (yep, packing the market with apps)
- UX Design
If you are looking for RIA or Mobile Development, we've got a talented group of developers working with us. Get in touch.
Rantings & Ramblings on the Convergence of Code and Business
//inside command class
public var mediatorClass:Class;
public var viewLocation:String;
override public function execute( note:INotification ):void
{
var m:IMediator = new mediatorClass() as IMediator;
m.viewComponent = getViewComponent( note.getBody() );
Facade.getInstance().registerMediator( m );
}
protected function getViewComponent( app:Object ):Object
{
var result:Object = app;
for each( var subItem:Object in viewLocation.split(".") )
{
result = result[subItem];
}
return result;
}
<mx:Grid dataProvider="{ModelLocator.getInstance().myDP}"/>
<mx:Button label="Click here" click="dispatchEvent(new Event('getDP'))" />
class SimpleController{
function SimpleController(){
Application.application.AboveViewHere.addEventListener('getDP', onGetDP );
}
private function onGetDP ( e:Event ):void{
var dpService:DPService= new DPService();
ModelLocator.getInstance().myDP= dpService.getDP();//binds ArrayCollection reference from service to ModelLocator
}
}
public class DPService(){
function DPService(){}
private var data:ArrayCollection;
public function getDP(){
var loader:URLLoader = new URLLoader();
loader.addEventListener("complete", onComplete);
loader.load(new URLRequest("someURL.aSweetExtension"));
data = new ArrayCollection();//create the ArrayCollection reference here
return data;//return the reference to the controller
}
private function onComplete( e:Event ):void{//get called when the service returns
var loader:URLLoader = e.target as URLLoader;
//loop over returned data and populate ArrayCollection
for each( var xml:XML in loader.data.items ){
data.addItem( xml.someProperty );//add data to ArrayCollection
}
//no need to return anything or dispatch an Event
}
}