1. Trang chủ
  2. » Công Nghệ Thông Tin

adobe flash cs5 on demand part 68 doc

7 135 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Nội dung

ptg 420 Chapter 17 Flash provides several tools for testing Flash files (ActionScript 2.0). The Debugger panel lets you find and locate errors hidden in an .swf file, while it's running in the Flash Player. You must view your SWF file in a special version of Flash Player called the Flash Debug Player (installed automatically when you install the Flash application). The Debugger panel shows a hierarchical display list of movie clips currently loaded in the Flash Player. You can then use the Debugger to display and modify variables and property values as the .swf file plays. You can insert breakpoints to stop the .swf file and step through the ActionScript code line-by-line. You can even use the Debugger panel to test files on a Web server in a remote location. The Debugger lets you set breakpoints in your ActionScript that stop the Flash Player, and then lets you step through the code as it runs. You can then go back to your scripts and edit them so that they produce the correct results. The Debugger will show you where the problems are, but it doesn't fix them. Debugging for ActionScript 2.0 Use the Debugger for ActionScript 2.0 Create or open a Flash document (ActionScript 2.0). Click the Debug menu, point to Debug Movie, and then click Debug. The Code View panel displays a message indicating the movie is paused. Click the Continue button to start the movie. Click the Stop Debugging button to turn off the Debugger panel. Click inside the code, and then click the Toggle Breakpoint button to add or remove a breakpoint at the insertion point of the cursor. Breakpoints stop the movie from playing and allow you to step through the code line-by-line. Click the Remove All Breakpoints button to remove all the breakpoints from the code. Click the Step Over, Step In, and Step Out buttons to step through each line of an ActionScript. 8 7 6 5 4 3 2 1 6 4 5 7 8 Testing Your Movie When you use the Test command to test movies that implement key- board shortcuts, click the Control menu, and then click Disable Keyboard Shortcuts. This prevents Flash from interpreting key- strokes, and lets them pass through to the player. For example, you can have a Flash document that uses Ctrl+U to display a file or video. However, Flash uses Ctrl+U to display the Preferences panel. If you don't Disable Keyboard Shortcuts, pressing Ctrl+U in the Flash player will actually open Flash Preferences. For Your Information From the Library of Wow! eBook ptg Chapter 17 Debugging a Movie 421 When you work in the debugger, you have the option of viewing any variables used in the Flash movie. The Variables tab (ActionScript 2.0) or Variables panel (ActionScript 3.0) displays the names and values of any global and variables in the .swf file. If you change the value of a variable, you can see the change reflected in the .swf file while it runs. This gives you the ability to test new data variables and their impact on the Flash player document. Viewing Variables View Variables Click the Debug menu, point to Debug Movie, and then click Debug. Select the movie clip containing the variable from the display list. Select an item in the display frame to view the variables’ names and values. Click the Continue button to observe the variables as the Flash movie runs. Click the Variables tab (ActionScript 2.0) or open the Variables panel (ActionScript 3.0). IMPORTANT The display list updates automatically as the .swf file plays. When a movie clip is removed from the .swf file at a specific frame, the movie clip, variable and variable name are removed from the display list in the Debugger panel. This lets you focus on the current variables. When you're viewing a complex Flash movie that contains a lot of variables, only having to view the current variables cuts down on the visual clutter and helps you to focus on the immediate problem. 5 4 3 2 1 2 5 4 Variables panel (ActionScript 3.0) From the Library of Wow! eBook ptg 422 Chapter 17 Adding Variables to the Watch List Add Variables In a Flash document (ActionScript 2.0), click the Debug menu, point to Debug Movie, and then click Debug. Click the Variables or Locals tab, and then select a variable. Click the Debugger Options button, and then click Watch. Click the Watch tab. Click the Debugger Options button, and then click Add Watch. Enter the target path to the variable name and the value in the fields. IMPORTANT To remove variables from the Watch list, select a variable on the Watch tab, click the Debugger Options button, and then click Remove Watch. 6 5 4 3 2 1 3 5 2 4 In any complex Flash movie, there will probably be a set of critical vari- ables that you want to keep an eye on. You can monitor critical vari- ables in a controllable way by marking them to appear in the Debugger panel Watch list (ActionScript 2.0). The Watch list displays the absolute path to the variable and its current value, and just like the Variables tab, you can enter a new variable value at any time during the debug- ging process. If you add a local variable to the Watch list, its value appears only when Flash Player is stopped at a line of ActionScript where that variable is in scope. All other variables appear while the .swf file is playing. If the Debugger can't find the value of the variable, it will list the value as undefined. 6 From the Library of Wow! eBook ptg Chapter 17 Debugging a Movie 423 The Properties tab in the Debugger panel displays all property values of any movie clip on the Stage. Properties are modifiable script elements such as _alpha (controls transparency) or _rotation (controls the rota- tion of an object). The Properties tab lists all the properties including their current values. You can then view and adjust the values as the Flash movie is running to judge their impact. This gives you a tremen- dous amount of control over the debugging process. Viewing Properties View Properties In a Flash document (ActionScript 2.0), click the Debug menu, point to Debug Movie, and then click Debug. Select an available movie clip from the Display list. Click the Properties tab to view all the properties, and their associated values. Double-click on a value, and then enter a new value in any available property. Click the Continue button to view how the Properties change as the Flash movie executes. IMPORTANT The Property value is picky about what you enter. For example, you can enter a value of 100 or text within quotes such as: "newvalue", but you cannot enter expressions such as: y + 12, or an array of values such as: 1, 2, 3. 5 4 3 2 1 23 5 4 From the Library of Wow! eBook ptg 424 Chapter 17 Breakpoints are instructions to the Debugger to halt the running of a Flash movie. For example, you're watching how the .swf file plays using the debugger, however, it's moving so fast it's difficult to watch every- thing. By inserting a breakpoint, you instruct the Debugger to halt the movie, and any variables and properties will display the values associ- ated with that point in time. You can then change the values, and instruct the Debugger to continue playing the movie, using the modified values. Setting Breakpoints Set Breakpoints Click the Debug menu, point to Debug Movie, and then click Debug. Click in the left margin next to the line of code where you want the breakpoint (red dot) to appear. ◆ You can also click the Toggle Breakpoint button (ActionScript 2.0) to add/remove a breakpoint. To rem ove a br ea kp oint, cl ic k th e existing breakpoint (red dot) in the left margin. Click the Continue button to begin playing the Flash .swf file. The Debugger will stop the movie at each breakpoint. 4 3 2 1 4 Breakpoint Did You Know? You can set or remove breakpoints in the Actions panel. In the Actions panel (ActionScript 2.0), click in the line you want, click the Debug Option button, and then select a command to set or remove breakpoints. You cannot set a breakpoint on a com- ment line. If you set a breakpoint in a comment (or empty line) in the Actions panel, the breakpoint will be ignored by the Debugger. To gg l e B r ea k po i nt 2 3 Breakpoints ActionScript 3.0 From the Library of Wow! eBook ptg Chapter 17 Debugging a Movie 425 When you open the Debugger, the Flash Player is automatically paused. This gives you the opportunity to set breakpoints in the script (see pre- vious lesson: Setting Breakpoints). Once the breakpoints are set, you can click the Continue or Play button, and the Debugger will play the .swf file until it encounters a breakpoint. When a breakpoint is reached, the Debugger again pauses the movie. You now have the option to step in, out, or through the breakpoint script. Stepping Through Code Step Through Code Click the Debug menu, point to Debug Movie, and then click Debug. Add breakpoints by clicking in the left margin next to the line of code where you want the breakpoint. To remove a breakpoint, click it. Click the Continue button. Flash will stop at the first breakpoint. Select from the step options: ◆ Continue. Click to leave the line at which the player is stopped and continue playing. ◆ Stop Debugging. Click to deactivate the Debugger, but continue to play the SWF file. ◆ Step In. Click to step into and execute a function (works only for user-defined functions). ◆ Step Out. Click to move out of a function (works only if you are currently stopped in a user- defined function). ◆ Step Over. Click to skip over a line of code. IMPORTANT If you want to know where the Debugger stopped, keep an eye on the yellow arrow. A yellow arrow along the left side of the Debugger's code view indicates the line at which the Debugger stopped. 4 3 2 1 3 2 The Yellow Arrow indicates where the Debugger stopped. Stop Debugging 4 Continue Current breakpoints From the Library of Wow! eBook ptg 426 Chapter 17 Debugging a Flash movie manually means exactly what it implies. You can open the movie and take it for a test drive. Debugging a movie manually gives you a chance to be the visitor, and experience your movie exactly as they would. When you manually test a Flash movie, you want to experience the wait time for downloading, you want to for- get that you created this masterpiece, and you want to come at it just as if you were a first-time viewer. A Flash movie is composed of text, video, audio, images, animation, and ActionScript. Your visitors will never see the ActionScript code, and most do not care how it was writ- ten; but they will care if it doesn't work properly. For example, your visi- tor clicks a button to load a video file, and the video never loads, or it takes so long to load that they get bored and leave. Problems like these are what manual debugging can solve. Debugging Manually Debug Manually Click the Control menu, point to Test Movie, and then click Test to test the entire Flash movie, or click Test Scene to test the active scene. IMPORTANT Flash uses the settings described in the Publish Settings dialog box to test the movie. Use different settings such as Flash plug-in, to test the movie against earlier versions of the Flash plug-in. Test the movie for any structural failures. Click all the buttons, and then do all the things you think a visitor would do. Note any problems on paper (remember this is manual) in a list, called a debug, or edit list. The list can then be used to edit the document, using Flash's standard editing tools. 3 2 1 Click and test all the buttons and input fields. See Also See C hapter 20, “Publishing a Movie ” on page 477 for information on modify- ing publishing settings. Debugging Flash Player When Adobe Flash is installed, the debug version of the Adobe Flash Player is installed for the application as well as any browser speci- fied. While this debug version of the player can be very useful when authoring, there may be situations where the standard player is desired. If you would like to uninstall the debug player, point your browser to: http://www.adobe.com/support/flash/ts/documents /remove_player.htm , and then follow the on-screen instructions. You can then point your browser to: http://www.adobe.com/shockwave /download/download.cgi?P1_Prod_Version=ShockwaveFlash , and download the current version of the player. For Your Information From the Library of Wow! eBook . all the buttons and input fields. See Also See C hapter 20, “Publishing a Movie ” on page 477 for information on modify- ing publishing settings. Debugging Flash Player When Adobe Flash is installed,. but continue to play the SWF file. ◆ Step In. Click to step into and execute a function (works only for user-defined functions). ◆ Step Out. Click to move out of a function (works only if. it. Click the Continue button. Flash will stop at the first breakpoint. Select from the step options: ◆ Continue. Click to leave the line at which the player is stopped and continue playing. ◆

Ngày đăng: 02/07/2014, 21:21