Learning Employee Directory 2.2 Commands

33 sec read

Return to table of contents
All command classes are inherited from class Command. By name, commands perform something. Every command has execute() which does the job, and emits progress and complete event, and possibly error event.

The base class, Command, has the following three main functions:

public function execute() : void
protected function notifyComplete() : void
protected function notifyProgress( progress:uint, progressMessage:String = null ) : void
protected function notifyError( msg:String ) : void

The execute() function has to be overridden and implemented by subclasses. Other functions in a command class are usually private — this makes perfect sense as commands are supposed to execute only.

When using (or calling) a command, ED usually does this (using InitApplicationCommand as an example):

var cmd : InitApplicationCommand = new InitApplicationCommand( stage );
cmd.addEventListener( CommandCompleteEvent.COMPLETE, onAppInitComplete );
cmd.addEventListener( CommandProgressEvent.PROGRESS, onAppInitProgress );
cmd.addEventListener( ErrorEvent.ERROR, onAppInitError );

You will find this pattern again and again in ED.


Want to receive new post notification? 有新文章通知我

How much money did I make from an app?

Undoubtedly some people are very successful in making money by developing a smartphone app. Back in 2012 I developed an app called “Handbook of Brain” which is a collected resources of brain anatomy, function and diseases. I put the app i
Xu Cui
27 sec read

Handy programs to visualize NIRS data (2): plotTopoMap

Often you need to view the spatial pattern of activation as in the example below. plotTopoMap allows you to do that. It probably only works for Hitachi devices where the spatial relationship between channels are known. In the above example, the activ
Xu Cui
37 sec read

Flash 3D video demo

Racer Ostrova Zombie
Xu Cui
0 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *