July 2003
Intermediate to advanced
896 pages
45h 43m
English
Once you have created all the components, you can breathe a sigh of relief knowing that you have completed all the difficult work. All that remains is to put the components together so they work in conjunction with one another to produce a complete, working application.
The main routine of the application is responsible for the following:
Adding all the necessary components to the movie at runtime
Loading the XML data
Listening for keypresses
To complete the main routine of the image viewer application, add the following code to the first frame of the default layer of the main timeline:
// Include the necessary libraries in the document.MovieClip.asis from Chapter 7, // andDrawingMethods.asis from Chapter 4 #include "MovieClip.as" #include "DrawingMethods.as" //Table.asandForms.asare from Chapter 11. #include "Table.as" #include "Forms.as" //TextField.asis from Chapter 8. #include "TextField.as" function init ( ) { draw( ); // Create theXMLobject and load theimages.xmldocument. Be sure to set //ignoreWhitetotrueso that the extra whitespace nodes are eliminated. imagesXML = new XML( ); imagesXML.ignoreWhite = true; imagesXML.load("images.xml"); imagesXML.onLoad = XMLOnLoad; } function draw ( ) { // Create the Menu component and the Preview Pane component. _root.attachMovie("MenuSymbol", "imagesMenu", _root.getNewDepth( )); _root.attachMovie("PreviewPaneSymbol", "previewPn", _root.getNewDepth( )); imagesMenu.setPreviewPane(previewPn); ...
Read now
Unlock full access