RE: [Flashcoders] Multi-dimensional array problems in classes

2007-01-22 Thread Merrill, Jason
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.

I agree - IMO best and most flexible way is an array of objects (which
objectg may have properties that are arrays of objects, etc.). 

Jason Merrill
Bank of America 
Learning  Organizational Effectiveness
 
 
 
 
 
 
___
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


Re: [Flashcoders] Multi-dimensional array problems in classes

2007-01-22 Thread eka

Hello :)

If you can compile your code in AS2 you can use my openSource framework
VEGAS and this ADT package (vegas.data) ... you can find in this library all
JAVA collections (Collection, Map, Iterator, List, Queue...) i think you can
find good tools for you problem :)

1 - go in the project pa: http://vegas.riaforge.com

2007/1/22, Merrill, Jason [EMAIL PROTECTED]:


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.

I agree - IMO best and most flexible way is an array of objects (which
objectg may have properties that are arrays of objects, etc.).

Jason Merrill
Bank of America
Learning  Organizational Effectiveness






___
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


RE: [Flashcoders] Multi-dimensional array problems in classes

2007-01-22 Thread Gareth Hudson
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: flashcoders@chattyfig.figleaf.com
  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. ___
  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
 
 
 ___
 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




-- 

: : ) Scott
___
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


[Flashcoders] Multi-dimensional array problems in classes

2007-01-20 Thread Gareth Hudson
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.
___
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


Re: [Flashcoders] Multi-dimensional array problems in classes

2007-01-20 Thread Stan Vassilev
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: flashcoders@chattyfig.figleaf.com
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.
___
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


Re: [Flashcoders] Multi-dimensional array problems in classes

2007-01-20 Thread Ron Wheeler

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: flashcoders@chattyfig.figleaf.com
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.
___
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



___
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


Re: [Flashcoders] Multi-dimensional array problems in classes

2007-01-20 Thread slangeberg

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: flashcoders@chattyfig.figleaf.com
 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.
 ___
 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


___
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





--

: : ) Scott
___
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