Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 363

removing external Content P Note: If you want to remove the ProLoader object from the Stage entirely, you can use the removeChild(). command. The code removeChild (myProLoader) removes the ProLoader object called myProLoader so that it is no longer displayed on the Stage. Once an external SWF file is loaded, how do you unload it to return to the main Flash movie? One way is to unload the SWF content from the ProLoader object, so the audience can no longer see it. You will use the command unload() to do this. 1 Select the first frame of the actionscript layer and open the Actions panel. 2 Add the following lines to your code in the Script pane: myProLoader.addEventListener(MouseEvent.CLICK, unloadcontent); function unloadcontent(e:MouseEvent):void { myProloader.unload(); } P Note: If your loaded content contains open streams (such as video or sounds), those sounds may continue even after you’ve unloaded the SWF from the ProLoader object. Use the unloadAndStop() command to extinguish the sounds as well as unload the SWF content. This code adds an event listener to the ProLoader object called myProLoader. When you click on the ProLoader object, the function called unloadcontent is executed. The function performs just one action: It removes any loaded content from the ProLoader object. 3 Choose Control > Test Movie > in Flash Professional to preview the movie. Click on any of the four sections, and then click on the loaded content to return to the main movie. 354 Lesson 9 Loading and Controlling Flash Content