Đang chuẩn bị liên kết để tải về tài liệu:
Foundation Flash CS4 for Designers- P11

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Foundation Flash CS4 for Designers- P11: I can remember the day as clear as if it were just yesterday. I was walking by my boss’s office late one winter afternoon at the college where I teach, and he called me into his office. Sitting on his desk was a thin, white box with some sort of weird swirl on it. He slid the box across to me and asked, “You know anything about Flash?” | TEXT 2. Click the Text layer and select the Text tool or press the T key. 3. Click the stage and enter Show the frog hide the frog. Specify these text settings in the Property inspector Type Static Text Font Arial Size 14 Color 000000 black 4. Select the text Show and hide and in the Property inspector change their color to 0099FF bright blue . 5. Using the Text tool select the text Show and enter event show into the Link field of the Property inspector as shown in Figure 6-29. The text you entered is the TextEvent LINK event you will be using when you write the code. Figure 6-29. Using a link to trigger an ActionScript text event 287 CHAPTER 6 6. Select the text hide and enter event hide into the Link field of the Property inspector. 7. Select the first frame in the Actions layer open the Actions panel and enter the following ActionScript addEventListener TextEvent.LINK linkHandler function linkHandler evt TextEvent void if evt.text show frog.visible true else frog.visible false The first line of the code creates the listener and tells Flash what to listen for textEvent LINK and what to do execute the function named linkHandler when it hears the event. The function checks to see which of the two hyperlinks was clicked. If it was the word Show and the event s text property is show then the frog movieclip has its visible property set to true which means the frog movieclip appears. The else simply says if it isn t the word Show then hide the frog movieclip by setting the movieclip s visible property to false. 8. Save and test the movie. Using hyperlinks with a dynamic text field Now that you know how to control events using static text let s try it out using a dynamic text field. 1. Open the DynamicTriggerAS.fla file in this chapter s Exercise folder. It is the same file as the previous exercise and all we are going to ask you to do is to write the code. 2. Select the first frame in the Actions layer open the Actions panel click once in the Script pane and enter the