Holy crap--excuse me- I never thought of it that way- I was looking at was
looking at a similar clone function but didn't realize that it was just a
matter of calling the constructor from inside and customizing it.
Initially I was trying to design this with a singleton model that would hold
a ref to multiple video views but changes in some specs have me trying to
have each view have a slightly altered copy of the model. I'm curious if
that means get rid of the singleton?
M
On 3/15/06, JesterXL <[EMAIL PROTECTED]> wrote:
>
> To make a true clone, it's about the same in AS2 & AS3:
>
> class YourModel
> {
> public var prop:String;
> public var data_array:Array;
>
> function YourModel ( p_prop:String )
> {
> prop = p_prop;
> data_array = [1, 2, 3, 4];
> }
>
> public function clone():YourModel
> {
> var ym:YourModel = new YourModel();
> ym.prop = prop;
> ym.data_array = [];
> var i:Number = data_array.length;
> while(i--)
> {
> ym.data_array[i] = data_array[i];
> }
> return ym;
> }
> }
>
> var a:YourModel = new YourModel("something");
> var b:YourModel = a.clone();
>
> ----- Original Message -----
> From: "Manuel Saint-Victor" <[EMAIL PROTECTED]>
> To: "Flashcoders mailing list" <[email protected]>
> Sent: Wednesday, March 15, 2006 10:21 AM
> Subject: [Flashcoders] Advice on how to make a copy of an object
>
>
> I need to make a local copy of an object- basically I have a model with
> some
> default values and would like each view to create a local model with
> customizations to some parameters. I've seen some ActionScript 3 ways to
> do
> this but am looking for the way it was done in AS2.
>
> Thanks,
> Mani
> _______________________________________________
> [email protected]
> 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
>
> _______________________________________________
> [email protected]
> 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
>
_______________________________________________
[email protected]
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