Is dictionary the best way to ID a class property in an event function?

[FONT=Times New Roman][SIZE=3]I have a question about accessing properties of a custom class from within another class. I can do it, but I’m not sure if I am doing it the right way – or if there is a simpler alternative.[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]I have a class called “legion” it contains a couple of properties, a sprite called “legio” and an integer called “loc”[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]I import the legion class into another class called “Main”.[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]Within Main I have a loop to create many versions of legion, passing parameters so that they all have unique loc values. These are put into an array called “legarray”:[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]for (i:int=0; i<20; i++) {[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]legarray.push(legion(i*10)); [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]I use the same loop to addChild(legarray.legio)*[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]I also add an event listener so that you can click and drag the sprites around.[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]This means that there is a single event function called within Main for whatever legio sprite is clicked.[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]As you can’t pass variables to an event function, I can move the sprite with:[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]currentTarget.x = whateverx[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]but I cannot change the loc variable[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]currentTarget.loc or target.loc don’t work…[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]I solved the dilemma with a dictionary object storing the name against i in the loop, so that I can do:[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]legarray[dictionaryobj(currentTarget)].loc = whatevern[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]So, is there another way?[/SIZE][/FONT]

(using flex sdk & SciTE)