Putting It All Together
With all the elements in place and contained within the movieGrid instance, you can position the whole unit centrally in your movie.
Click Frame 1 (the script layer) in the main movie.
Insert the following script after the volume slider positioning script:
Test your movie and preview some sounds; click a box and click again to deselect it. If you are happy with your selections, click the Play button and enjoy your composition.
That's it. Save your work.
Listing 15
//Positioning all attached elements movieGrid._x = ((Stage.width/2) - (movieGrid._width/2))+(BOXWIDTH/COLUMNS)/COLUMNS; movieGrid._y = ((Stage.height/2) - (movieGrid._height/2))+BOXHEIGHT/2;
Here, you define the _x and _y properties of the movieGrid instance so that it is centrally positioned. These values will be flexible based on the rows and columns variables.