Same event multiple commands
This code snippets below should help calify what is meant in the title. My aim was to minimise the number of events that i had to create to woth with products( The constants are to make CRUD activities simple).. the first snippet crashed the code ). Cairngorm does not like mapping of same event to more than one command which is not very cool........is this a bug or am i doing somthing wrong ( I hope i am )...
<codeSnippet>
this.addCommand(TProductsEvent.TPRODUCTS_EVENT, TListProductsCommand);
this.addCommand(TProductsEvent.TPRODUCTS_EVENT, TGetProductsByMemberCommand);
</codeSnippet>
<codeSnippet>
package net.sps.mobileadmanager.event
{
import com.adobe.cairngorm.control.CairngormEvent;
import flash.events.Event;
import net.sps.mobileadmanager.VO.TProductListVO;
public class TProductsEvent extends CairngormEvent
{
// opetations
public static const CREATE:uint=0;
public static const DELETE:uint=2;
public static const LIST:uint=3;
public static const TPRODUCTS_EVENT:String="TPRODUCTSE_VENT";
public static const UPDATE:uint=1;
public function TProductsEvent(type:String, products:TProductListVO=null, operation:uint=3, bubbles:Boolean=false, cancelable:Boolean=false)
{
this.products=products;
this.operation=operation;
super(type, bubbles, cancelable);
}
private var _operation:uint;
private var _products:TProductListVO;
override public function clone():Event
{
return new TProductsEvent(this.type, this.products, this.operation, this.bubbles, this.cancelable);
}
public function get operation():uint
{
return _operation;
}
public function set operation(value:uint):void
{
_operation=value;
}
public function get products():TProductListVO
{
return _products;
}
public function set products(value:TProductListVO):void
{
_products=value;
}
}
}
</codeSnippet>
