Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

  • Print
  • + Share This
From the author of

Scripting the Playhead

Just as you generated the grid dynamically earlier, you will also use ActionScript to attach the playhead dynamically so that it is always positioned relative to the size of your variable-defined grid.

You'll begin with the playHead movie clip, which consists of an upper arrow (graphic), a center bar (bar movie clip), and a bottom arrow (knob movie clip). The challenge comes with sizing the bar to match the grid. You will accomplish this by scaling the bar to the height of your movieGrid container and placing the bottom arrow below that.

  1. Double-click on the playHead movie clip in the Library and enter Edit mode. See Figure 10.

  2. Figure 10Figure 10

  3. Click on the knob movie clip on the Stage. Using the Properties panel, assign to it the instance name knob.

  4. Click on the bar movie clip on the Stage. Assign to it the instance name bar.

  5. Right-click/Ctrl-click on the playHead movie clip in the Library and select Linkage.

  6. Select the Export for ActionScript option. The identifier name playHead is inserted automatically.

  7. Go back to the main Timeline. Select Frame 1 of the script layer.

  8. After the following three lines

  9. soundNum++;
       }
     }

    add this script:

    Listing 07

    //Building the Playhead and placing it on the Stage
    movieGrid.attachMovie("playHead","playHead",10000);
    movieGrid.playHead.bar._height = movieGrid._height;
    movieGrid.playHead.knob._y = movieGrid._height;
    movieGrid.playHead._x -= BOXWIDTH/COLUMNS;

    This script checks the height of the movieGrid movie clip and, based on that value, it stretches the bar movie clip and positions the knob at the bottom of the movieGrid.

  10. Save your work.

  • + Share This
  • 🔖 Save To Your Account