Creating simple command? (Command)

Commands are used to handle application business logic.

Look at them as sophisticated functions!

To create one you need to do 3 things:

  1. extend Command class
  2. create public function execute()
  3. create one and only one parameter in execute() function. (of any type you need, or if you don’t need any parameters put dummy parameter. (for example: blank:Object));

Your command will look like this:

[as3 gutter=”1″ highlight=”4,9″] package com.mindScriptAct.sample.controler.test{
import org.mvcexpress.mvc.Command;

public class TestCommand extends Command {

//[Inject] //public var myProxy:MyProxy;

public function execute(params:Object):void {



  • It is a good practice to end your Command class names with ‘Command’.
  • It is a good practice to put your command’s in package ‘controller’. (organized to sub-folders by application features or by command purpose.)
  • Commands can be instantiated only by framework.