An XML-Based Navigation System 26 27 28 29 30 31 32 33 _xml = new XML(); initLoader(); initMenus(); } catch (err:TypeError) { trace("Can't parse loaded content as XML:", ); } } N OT E The initLoader() method creates an instance of the SafeLoader class (line 36), positions it below the future location of the menus (line 37), and adds it to the display list (line 38). It also draws a 750 × 450 pixel movie clip (lines 40 through 44), adjusts its y position to 100, the same location as the SafeLoader instance (line 45), and uses it to mask the loaded content (line 46). 34 35 36 37 38 39 40 41 42 43 44 . | An XML-Based Navigation System 26 27 28 29 30 31 32 33 _xml new XML initLoader initMenus catch err TypeError trace Can t parse loaded content as XML The initLoader method creates an instance of the SafeLoader class line 36 positions it below the future location of the menus line 37 and adds it to the display list line 38 . It also draws a 750 X 450 pixel movie clip lines 40 through 44 adjusts its y position to 100 the same location as the SafeLoader instance line 45 and uses it to mask the loaded content line 46 . NOTE Using a mask prevents loaded content from appearing outside the area dedicated for its display something that frequently happens when assets follow the mouse for example. If you want to see what the project looks like without a mask at any point simply comment out line 46 when testing. 34 35 36 37 38 39 40 41 42 43 44 45 46 47 loader and mask private function initLoader void _loader new SafeLoader 100 _loader var loaderMask MovieClip new MovieClip var g Graphics 0x000000 1 0 0 750 450 100 loaderMask NOTE See Chapter 13 for information about a modification made to Adobe s SafeLoader class. The initMenus method creates an instance of the NavigationBarXML class lines 50 and 51 and adds it to the display list line 52 . In doing so it passes the scope of the document class into the constructor as well as the menus XMLList. This makes all of the menu XML data available to the class so it can create the necessary buttons. The method also creates a DropShadowFilter instance line 54 sets its alpha to 25 percent and adds it to the _navBar instance. This will give the entire menu system including the submenus that appear interactively a drop shadow. 48 navigation menu bar 49 private function initMenus void 50 var _navBar NavigationBarXML 51 new NavigationBarXML this 52 _navBar 53 54 var ds DropShadowFilter new