Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 357
P Note: You can also
use the ProLoader and
URLRequest objects to
dynamically load image
files. The syntax is
identical. Simply replace
the SWF filename
with a JPEG filename,
and Flash loads the
specified image.
7 Choose Control > Test Movie > in Flash Professional to see your movie so far.
The front page plays its animation and stops. When you click on the movie star,
the file called page1.swf loads and is displayed.
8 Close the SWF called 09_workingcopy.swf.
9 Select the first frame of the actionscript layer and open the Actions panel.
10 Copy and paste the event listener and the function so you have four distinct
listeners for each of the four movie clips on the Stage. The four listeners should
appear as follows:
page1_mc.addEventListener(MouseEvent.CLICK, page1content);
function page1content(e:MouseEvent):void {
var myURL:URLRequest=new URLRequest("page1.swf");
myProLoader.load(myURL);
addChild(myProLoader);
}
page2_mc.addEventListener(MouseEvent.CLICK, page2content);
function page2content(e:MouseEvent):void {
var myURL:URLRequest=new URLRequest("page2.swf");
myProLoader.load(myURL);
addChild(myProLoader);
}
348
Lesson 9
Loading and Controlling Flash Content