Hello :) Yes an Array can be better :) But in my experience i prefere use the native flash.utils.Dictionnary class or a custom HashMap implementation based on the Java Collections like it :
http://svn1.cvsdude.com/osflash/vegas/AS3/trunk/src/vegas/data/map/HashMap.as http://vegas.ekameleon.net/docs/vegas/data/map/HashMap.html PS : You can use my AS3 opensource abstract data type (ADT) library in the vegas.data.* package : http://code.google.com/p/vegas/ EKA+ :) 2007/9/2, T. Michael Keesey <[EMAIL PROTECTED]>: > > On 9/1/07, [p e r c e p t i c o n] <[EMAIL PROTECTED]> wrote: > > greetings experts! > > > > way back in the days of as2 you could do something like this... > > > > this["somevarname"+someIndex] = new Something(); > > Even in AS2, it seems that this would be better done with an array. > > var somethings:Array = []; > something[someIndex] = new Something(); > > (Same syntax in AS3.) > > Come to think of it, even in AS1 it would be better done with an > array. The last time I would have used such a structure was in Flash 4 > Actions. > > One exception might be for MovieClip/Button/TextField instances in > AS2. Often in AS2 it was handy to grab those by their name, since they > are often made through the IDE rather than through code. The new way > of retrieving a composed display object by its name is the > getChildByName() function of the DisplayObjectContainer class (which > Sprite, among others, extends). So you could do something like this > within some class that extends DisplayObjectContainer: > > var currentObject:DisplayObject = getChildByName("someVarName" + > someIndex); > > I'm still not sure if that would be the most elegant solution in most > situations, though. It still seems to me that in most cases an array > should be somehow involved. > > -- > Mike Keesey > _______________________________________________ > [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

