PHOTOGRAPHERSONLINEPROOFING.COM

paper proof - www.photographersonlineproofing.com

Menu


You created the symbols, named the instances, and put everything into place for the ActionScript. Here's how the ActionScript used the instance


names you put in place. You'll learn about ActionScript in Lesson 7. When the event listener recognizes that the first frame is playing (that is, that the website has been opened), ActionScript loads the movie home.swf at the coordinates of the photo frame. Then it moves the marker_mc instance (the active selection marker you created) to the frame labeled "home." At that frame, you positioned the marker above the first button. stop(); var myloader:Loader = new Loader(); addEventListener(Event.ENTER_FRAME, home); function home(e:Event):void { removeEventListener(Event.ENTER_FRAME, home); var request:URLRequest = new URLRequest("home.swf"); myloader.load(request); addChild(myloader); myloader.x=36; myloader.y=145; marker_mc.gotoAndStop("home"); } Each remaining section of the script activates one button. An event listener listens for the mouse click, and then ActionScript loads the appropriate photo at the photo frame coordinates, and it moves the marker_mc instance to the corresponding frame label. Note that the buttons are referred to by their instance names (btn1_btn, and so on), and that the marker is referred to by its instance name, marker_mc. btn1_btn.addEventListener(MouseEvent.CLICK, image1); function image1(event:MouseEvent):void { var request:URLRequest = new URLRequest("home.swf"); myloader.load(request); addChild(myloader); myloader.x=36; myloader.y=145; marker_mc.gotoAndStop("home"); } btn2_btn.addEventListener(MouseEvent.CLICK, image2); function image2(event:MouseEvent):void { var request:URLRequest = new URLRequest("photo1.jpg"); myloader.load(request); addChild(myloader); myloader.x=36; myloader.y=145; marker_mc.gotoAndStop("section1"); } Review Review Questions 1 How can you label frames, and when is it useful 2 Which tool lets you change the direction for a gradient 3 How can you test a button on the Stage 4 How do you name an instance, and why is it necessary 5 Describe a quick way to create multiple layers, each containing a separate object. Review Answers