AS3 navigation with movieclips in library... how?

Hello good people,

Here is my challenge (thank you for your help!):

Introduction:
I have an interactive timeline consisting of 10 dates.
-1900, 1910, 1920, … 2000 (for example).

I therefore, have 10 buttons.
The buttons were created in Photoshop, imported into flash, turned into ‘button symbols’ to account for the default, hover and click properties.

So now the ‘button symbols’ appear in the library and have the appropriate, ‘Export for ActionScript’ class names: Button1900, Button1910, Button1920, … Button2000 (for example).

Goals:

  1. Put 10 buttons onto the stage
  2. Use Tweener to animate each button
  3. All 10 buttons will have their own function

Here is what I have so far:

 
 
// instances of the 10 buttons
private var button1900:Button1900 = new Button1900;
private var button1910:Button1910 = new Button1910;
private var button1920:Button1920 = new Button1920; 
...
private var button2000:Button2000 = new Button2000; 
 
// adding and positioning 10 buttons onto stage
addChild(button1900); button1900.x=100; button1900.y=200; 
addChild(button1910); button1910.x=100; button1910.y=250;
addChild(button1920); button1920.x=100; button1920.y=300;
...
addChild(button2000); button2000.x=100; button2000.y=650;
 
// add tweener to all 10 buttons
Tweener.addTween(button1900, 
{x:100, y:190, time:3, delay:0.6, transition: "easeOutCubic"});
Tweener.addTween(button1910, 
{x:100, y:240, time:3, delay:0.6, transition: "easeOutCubic"});
Tweener.addTween(button1920, 
{x:100, y:290, time:3, delay:0.6, transition: "easeOutCubic"});
...
Tweener.addTween(button2000, 
{x:100, y:490, time:3, delay:0.6, transition: "easeOutCubic"});
 
// attach event listener to run a function for each button
button1900.addEventListener(MouseEvent.CLICK, display1900);
button1910.addEventListener(MouseEvent.CLICK, display1910);
button1920.addEventListener(MouseEvent.CLICK, display1920);
...
button2000.addEventListener(MouseEvent.CLICK, display2000);
 

Conclusion:
I was able to accomplish my goals, but with too much code.
Is it possible to accomplish my goals, but with less code?

Should I be using an ‘array’ to contain all 10 buttons?
Should I be using a ‘for loop’ to put them onto the stage?
If so, what is an efficient way of doing this?

If anyone could point me in the right direction,
or provide me with an example, that would be great. :slight_smile:

Thank you for your time,

-Reinhold