Thanks everyone for the assistance as it has helped me to get it
working.

Regards,

Gareth.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
slangeberg
Sent: 20 January 2007 20:42
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Multi-dimensional array problems in classes


I agree with previous, however, it is good to deal with references in
classes. Best design for your 2D array depends on what it's intended
for?:

var reactionStoichiometry:Array = new Array ();

public function addItem( newArr:Array ):Number {
   //returns len(?)
   return reactionStoichiometry.push( newArr );
}

used like:
var yorObject:YourClass = new YourClass();

var newArr:Array = new Array (1, 3, 2, 0),

yorObject.addItem( newArr );
yorObject.addItem( new Array( 1,2,1,0 ) );
...etc....


-Scott

On 1/20/07, Ron Wheeler <[EMAIL PROTECTED]> wrote:
>
> BTW, Classes love Objects of all types regardless of the arrays.
>
> Just a hint.
> Often multi-dimensional arrays are just crying out to be single arrays

> of objects and if their wish is granted, your code becomes amazingly 
> small and elegant as your reward for granting their wish.
>
> Help make an array's wish become true!!! If you pass this on to 6 
> programmers in the next 24 hours, you will be granted good karma for a

> year.
>
> Ron
>
> Stan Vassilev wrote:
> > When you assign dynamic or more complex values, and especially if 
> > you don't want this array to be shared (by reference) to all 
> > instances of the class, it's best to initialize in the constructor.
> >
> > There aren't any limitations on multidim. arrays in objects, 
> > classes, or objects in classes and so on. I suspect the particular 
> > syntax you used was not correct, hence your issues. It'd help to 
> > post this instead.
> >
> > Regards, Stan Vassilev
> >
> > ----- Original Message ----- From: "Gareth Hudson" 
> > <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Saturday, January 20, 2007 2:02 PM
> > Subject: [Flashcoders] Multi-dimensional array problems in classes
> >
> >
> >> Hi there,
> >>
> >> Does anyone know if it we are supposed to use multi-dimensional 
> >> arrays (an array consisting of arrays) within a class?  If so, what

> >> is the best, legal way to create them?
> >>
> >> The only way I have managed to do it is by this method:
> >>
> >> var reactionStoichiometry:Array = new Array (
> >> new Array (1, 3, 2, 0),
> >> new Array (1, 2, 1, 0),
> >> new Array (2, 1, 2, 0),
> >> new Array (2, 0, 1, 3),
> >> new Array (2, 0, 2, 1),
> >> new Array (1, 0, 1, 1),
> >> new Array (1, 1, 2, 0),
> >> new Array (1, 1, 2, 0),
> >> new Array (1, 1, 1, 1));
> >>
> >> Any other ways of creating them give me a compile error saying that
> they
> >> are not allowed within a class.  I need to assign these values 
> >> dynamically, the above ones a for testing, and would prefer to do 
> >> it by addressing the locations in the main array by position number

> >> for inserting the other arrays within it.  Classes don't seem to 
> >> like Objects containing arrays either.
> >>
> >> Many thanks,
> >>
> >> Gareth Hudson. _______________________________________________
> >> [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
>



-- 

: : ) Scott
_______________________________________________
[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

Reply via email to