Actually, Cairngorm does allow arbitrary mappings from events to commands,
it does not require 1-to-1.
The FrontController's addCommand() function takes an event name (String) and
a Command class. In our app I have used the same event with different
name-constants to run different commands, like so:
addCommand(FollowingEvent.ADD, AddFollowingCommand);
addCommand(FollowingEvent.REMOVE, RemoveFollowingCommand);
In the constructor of FollowingEvent I take a "type" (String) parameter
which I pass through to CairngormEvent's constructor.
Dave
And one more thing I dislike is the 1 on 1 mapping of Events and Commands.
>
>> From what I've seen in their docs and samples they use a different Event
>> class for every Command, which IMO makes no sense.
>>
>
> GetUserEvent
> UpdateUserEvent
> DeleteUserEvent
> CreateUserEvent
>
> And the static constants are stored someplace else, can't remember but
> think it was the Controller (that extends FrontController).
>
> Rather than having 4 Event classes for each Command I prefer 1 Event class:
>
> UserEvent
>
> which has as many static constants as required:
>
> public static const GET_USER:String = "getUser";
> public static const UPATE_USER:String = "updateUser";
> public static const DELETE_USER:String = "deleteUser";
> public static const CREATE_USER:String = "createUser";
>
> Again this is inline with what is already present in the Flex framework:
>
> MouseEvent.CLICK
> MouseEvent.MOUSE_DOWN
> MouseEvent.MOUSE_UP
>
> etc..
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders