Projects

Example 4 - Buttons Generated from Array

Intro : Example 1 : Example 2 : Example 3 : Example 4

Library

Construction

Actionscript

Attached to invisible button on button movieclip timeline

on(release) {
  _parent.content.gotoAndStop(frame);
}

Attached to frame 1

buttonNames = new Array("Home", "Services", "Products", "Advantages", "Process", "Contact");
buttonHeight = 23;
for (i = 0; i < buttonNames.length; i++) {
  _root.attachMovie('button', 'button'+i, i);
  _root['button'+i]._x = 0;
  _root['button'+i]._y = i*buttonHeight;
  _root['button'+i].text = buttonNames[i];
  _root['button'+i].frame = i+1;
}

stop();

Advantages

Disadvantages

Recently Played on iTunes

  1. “Heroin”
    The Velvet Underground & Nico
    The Velvet Underground
    11/17/08 16:26
  2. “All Tomorrow's Parties”
    The Velvet Underground & Nico
    The Velvet Underground
    11/17/08 16:20
  3. “Run Run Run”
    The Velvet Underground & Nico
    The Velvet Underground
    11/17/08 16:16

Last 100 Songs >