July 2003
Intermediate to advanced
896 pages
45h 43m
English
You have now created all the necessary components for the Flash Paint application. The only remaining step is to create the main routine that puts them all together. To accomplish this, add the following code to the first frame of the main timeline of the flashPaint.fla document:
// IncludeMovieClip.asfrom Chapter 7,DrawingMethods.asfrom Chapter 4, and //Table.asfrom Chapter 11 for their custom methods. #include "MovieClip.as" #include "DrawingMethods.as" #include "Table.as" // Initialize the movie. function init( ) { selectedShape = null; selectedTool = null; shapes = new Array( ); makeTools( ); } // ThemakeTools( )method creates the toolbar buttons. function makeTools ( ) { // Define an array of the first six tool names. These names match the accepted // values within the toolbar button component. toolbarBtnNames = ["select", "line", "rectangle", "ellipse", "text", "fill"]; // Create an array to hold references to the "stick" toolbar button instances. toolbarBtns = new Array( ); // Create atoolbarmovie clip to contain all the tools (including // the color selector) and a nestedbtnsmovie clip to specifically // contain the toolbar buttons. _root.createEmptyMovieClip("toolbar", _root.getNewDepth( )); toolbar.createEmptyMovieClip("btns", toolbar.getNewDepth( )); var name, btn; // Create a table for holding the buttons. Set the row spacing to three pixels. t = new Table(3); // Loop through all the names of the buttons. for (var i ...
Read now
Unlock full access