[Flashcoders] factory with varying numbers of params

2007-05-02 Thread pedr browne
. I could do it in a separate method in the factory I suppose. Thanks Message: 17 Date: Tue, 1 May 2007 09:30:32 -0700 From: T. Michael Keesey [EMAIL PROTECTED] Subject: Re: [Flashcoders] factory with varying

RE: [Flashcoders] factory with varying numbers of params

2007-05-02 Thread Danny Kodicek
Thanks a lot for all the replies. Most helpful. It's a funny situation. I'm using a deserialised XML file to dictate the content and layout of each page. A page might contain 1. A heading, 2. A TextField 3. A link or it might contain 1.A heading 2. A thumbnailMenu or various other

Re: [Flashcoders] factory with varying numbers of params

2007-05-02 Thread Ron Wheeler
Looks like a Decorator Pattern. Danny Kodicek wrote: Thanks a lot for all the replies. Most helpful. It's a funny situation. I'm using a deserialised XML file to dictate the content and layout of each page. A page might contain 1. A heading, 2. A TextField 3. A link or it might contain

[Flashcoders] factory with varying numbers of params

2007-05-01 Thread pedr browne
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

Re: [Flashcoders] factory with varying numbers of params

2007-05-01 Thread Listas
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];

Re: [Flashcoders] factory with varying numbers of params

2007-05-01 Thread Andy Herrman
There are two ways I can think of to do this. One would be to have multiple factory functions, one for each type of object you want to create. The other would be to create a simple class (FactoryParams or something like that) which stores all the parameters. You pass that as the parameter

Re: [Flashcoders] factory with varying numbers of params

2007-05-01 Thread T. Michael Keesey
On 5/1/07, pedr browne [EMAIL PROTECTED] wrote: 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{