pedr, i would prefer to use the arguments array, instead of an object, but i´m afraid this isn´t strong typed as you wish

private function createItem(key:String):Void{

 switch(key){
case "item_1": var wid_num:Number = arguments[1];
       var y_num:Number = arguments[2];
       myItem = new Item_1(wid_num, y_num);
       break
   case "item2":
       var hei_num:Number = arguments[1];
       var color_num:Number = arguments[2];
       myItem = new Item_2(hei_num, color_num);
       break
   etc...
 }

}

Ruy Adorno
Hi,

A have a Factory that needs to instanciate Objects with differing numbers of parameters (1-4). Is there any way to deal with this situation and maintain
strong typing.

private function createItem(param_ob:Object, key:String):Void{
  switch(key){
     case "item_1":
        myItem = new Item_1(param_ob.width, param_ob.y);
        break
    case "item2":
        myItem = new Item_2(param_ob.height, param_ob.color);
        break
    etc...
  }
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to