SlideShare a Scribd company logo
Extensions & Utilities
Who am I
Yennick Trevels
Rich Application Consultant @ iDA MediaFoundry
Adobe Flex 4 Certified Expert
Robotlegs
3rd generation MVC(S) Micro architecture
Lightweight
Dependency Injection
Robotlegs Extensions
Signals extension
Use signals to trigger commands
Automatic injection of signal parameters
into the commands
AS3-Signals: example
var contactsLoaded:Signal = new Signal(ArrayCollection);
contactsLoaded.add(contactsLoadedHandler);
contactsLoaded.dispatch(contacts);
private function contactsLoadedHandler(contacts:ArrayCollection):void
{
// handler code
}
Signals extension: Usage
Context
public class MyContext extends SignalContext {
override public function startup():void {
… //other injection mappings
injector.mapSingleton(SaveContactSignal);
signalCommandMap.mapSignalClass(
SaveContactSignal, SaveContactCommand);
}
}
Signals extension: Usage
Mediator
public class ContactFormMediator extends Mediator{
[Inject]
public var saveContact:SaveContactSignal;
...
private function saveButton_click(event:MouseEvent):void {
saveContact.dispatch(contact);
}
}
Signals extension: Usage
Command
public class SaveContactCommand extends SignalCommand {
[Inject]
public var contact:Contact;
...
override public function execute():void {
contactService.saveContact(contact);
}
 }
ModuleContext
Modular extension
Without the extension:
 One Context per module
 Each module works independently
 No communication between modules
Facilitates communication between modules
Shell
IModuleEventDispatcher
ModuleContext
Module
ModuleContext
Module
Modular extension: Usage
Module Context
public class MyModuleContext extends ModuleContext { ... }
Module general Mediator
public class MyModuleMediator extends ModuleMediator {
...
private function exitModuleHandler():void {
var exitModuleEvent:ModuleEvent = new
ModuleEvent(ModuleEvent.EXIT_MODULE);
dispatchToModules(exitModuleEvent);
}
}
Modular extension: Usage
Shell/Module Mediator
public class ShellMediator extends ModuleMediator {
override public function onRegister():void {
eventMap.mapListener(moduleDispatcher,
ModuleEvent.EXIT_MODULE, moduleExitHandler,
ModuleEvent);
}
...
}
Signals & Modular
extension?
Not possible by default
Solution
1. Take the SignalContext code and copy it into a new
ModuleSignalContext class
2. Take the ModularContext code and merge it into the new
class
3. Done & works like a charm
OptionCommandMap utility
Run different command based on selected option
Use case:
1. User has the choice between several options
2. Based on the chosen option a different command will
run
Automatic removal of mappings after one option
has been processed
Removes the need for an custom event per option
OptionCommandMap utility
Streamlines the following:
Setup
commandMap.mapEvent(SelectCharacterEvent.MAGE,
SelectMageCommand, SelectCharacterEvent);
commandMap.mapEvent(SelectCharacterEvent.WARRIOR,
SelectWarriorCommand, SelectCharacterEvent);
Once a command has been processed
commandMap.unmapEvent(SelectCharacterEvent.MAGE,
SelectMageCommand, SelectCharacterEvent);
commandMap.unmapEvent(SelectCharacterEvent.WARRIOR,
SelectWarriorCommand, SelectCharacterEvent);
OptionCommandMap:
Usage
Context
override protected function mapInjections():void {
super.mapInjections();
injector.mapValue(IOptionCommandMap, new
OptionCommandMap(eventDispatcher, injector, reflector));
}
Inside Mediator or Command
//map the options
optionCommandMap.mapOption(1, SelectMageCommand);
optionCommandMap.mapOption(2, SelectWarriorCommand);
OptionCommandMap:
Usage
Trigger an option
var event:OptionEvent = new OptionEvent(OptionEvent[“OPTION_1”]);
dispatch(event);
Macrobot utility
execute commands in:
Sequence: SequenceCommand
Parallel: ParallelCommand
Macrobot: Usage
Parallel
var command:ParallelCommand = new ParallelCommand();
command.addCommand(FirstCommand);
command.addCommand(SecondCommand);
Command.addCompletionListener(command_completeHandler);
command.execute();
private function command_completeHandler(success:boolean):void
{
//perform completion code here
}
Macrobot: Usage
Sequence
var command:SequenceCommand = new SequenceCommand();
command.addCommand(FirstCommand);
command.addCommand(SecondCommand);
Command.addCompletionListener(command_completeHandler);
command.execute();
private function command_completeHandler(success:boolean):void
{
//perform completion code here
}
Resources
Robotlegs
http://www.robotlegs.org/
Signals extension
https://github.com/joelhooks/signals-extensions-CommandSignal
Modular extension
https://github.com/joelhooks/robotlegs-utilities-Modular
OptionCommandMap utility
https://github.com/Stray/robotlegs-utilities-OptionCommandMap
Macrobot utility
https://github.com/Aaronius/robotlegs-utilities-Macrobot

More Related Content

DOC
Comp 328 final guide (devry)
KEY
Design by Contract in robotlegs AS3
KEY
Robotlegs 2 and your brain
PPTX
Flex modular applications using robotlegs
KEY
Application Frameworks - The Good, The Bad & The Ugly
PPT
PDF
RobotLegs
PDF
Robotlegs AS3 from Flash and the City 2010
Comp 328 final guide (devry)
Design by Contract in robotlegs AS3
Robotlegs 2 and your brain
Flex modular applications using robotlegs
Application Frameworks - The Good, The Bad & The Ugly
RobotLegs
Robotlegs AS3 from Flash and the City 2010

Viewers also liked (14)

PPTX
Ivan Shaban - Robotlegs 2+
PDF
Luxury beauty brands - Sustainability is good for business
PPTX
Economics
PPTX
Ethics
PDF
Luxury beauty brands - Getting communication right between global teams
PPTX
MY INTERN EXPERIENCE @ CPL
PPTX
equal employment
DOC
Analisis konteks
PPTX
Live the khas lifestyle
PPTX
Durda presentation
PPTX
Slick - The Structured Way
PPTX
Combining Angular and React Together
PDF
React server side rendering performance
PDF
Luxury beauty brands - POS Production Models
Ivan Shaban - Robotlegs 2+
Luxury beauty brands - Sustainability is good for business
Economics
Ethics
Luxury beauty brands - Getting communication right between global teams
MY INTERN EXPERIENCE @ CPL
equal employment
Analisis konteks
Live the khas lifestyle
Durda presentation
Slick - The Structured Way
Combining Angular and React Together
React server side rendering performance
Luxury beauty brands - POS Production Models
Ad

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
Teaching material agriculture food technology
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Tartificialntelligence_presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Teaching material agriculture food technology
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Big Data Technologies - Introduction.pptx
Programs and apps: productivity, graphics, security and other tools
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
A comparative analysis of optical character recognition models for extracting...
Tartificialntelligence_presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Group 1 Presentation -Planning and Decision Making .pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Accuracy of neural networks in brain wave diagnosis of schizophrenia
MIND Revenue Release Quarter 2 2025 Press Release
Ad

Robotlegs Extensions

Editor's Notes

  • #3: Implement Enterprise RIA applications with Java & Flex Following robotlegs for a while now
  • #5: Short overview of Robotlegs structure
  • #7: Alternative to events in actionscript
  • #10: SignalCommand = actually just a Robotlegs Command, but with the advantage that parameters from the signal dispatch call will be automatically injected
  • #11: Possible to work in a modular fashion with robotlegs without the extension
  • #12: Mediator which mediates the main view of your module  exists as long as your module  can dispatch module events or listener to events from other modules/shell application
  • #15: Why OptionCommandMap: - Removes the need for an event class per option - automatic cleanup
  • #16: Why OptionCommandMap: - Removes the need for an event class per option - automatic cleanup
  • #20: Dependency injection is performed before executing the commands  no need to worry about that