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

adobe flash cs5 on demand part 67 pps

7 194 0

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

THÔNG TIN TÀI LIỆU

Nội dung

ptg When a problem is encountered, Flash displays the location and description of the warnings and errors in the Compiler Errors panel. In the Compiler Errors panel, you can show or hide warnings or errors (New!), scroll through each one (New!), and display/highlight them in the code (New!). You can also manage the types of compiler warning that appear in the Compiler Errors panel by setting options in the Publish Settings dialog box. Two options are available: Strict Mode and Warnings Mode. Strict Mode reports warnings as errors, while Warnings Mode reports extra warnings for discovering incompatibili- ties when updating ActionScript 2.0 code to ActionScript 3.0. 418 Chapter 17 Resolving Compiler Errors Resolve Compiler Errors Create or open a Flash document (ActionScript 3.0). Click the Control menu, point to Test Movie, and then click Test. If an error occurs, the Compiler Errors panel opens displaying the errors found during the execution. Open the Compiler Errors panel. In the Compiler Errors panel, use the following options to resolve compiler errors: ◆ View Warnings or Errors in the Code. Select the warning or error, and then click the Go To Source button, or double-click the warning or error to display it in the Actions panel. ◆ Display Warnings or Errors. Click the Go To Previous or Go To Next button. The code line with the error highlights in the Actions panel. ◆ Clear Warnings and Errors. Click the Clear button. ◆ Show or Hide Warnings or Errors. Click the Warning(s) or Error(s) button at the bottom of the Compiler Errors panel. 4 3 2 1 3 Show or hide errors or warnings 4 Source of error from the Compiler Errors panel Errors due to a change from ActionScript 2.0 to ActionScript 3.0 From the Library of Wow! eBook ptg Chapter 17 Debugging a Movie 419 Control Compiler Warnings Create or open a Flash document (ActionScript 3.0). Click the File menu, and then click Publish Settings. Click the Flash tab. Click the Settings button for ActionScript 3.0 Select the Strict Mode check box to report warnings as errors. Select the Warnings Mode check box to report extra warnings for discovering incompatibilities when updating ActionScript 2.0 code to ActionScript 3.0 code. Click OK. Click OK. 8 7 6 5 4 3 2 1 3 4 8 7 6 5 From the Library of Wow! eBook 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 ov e a br ea kp oint , cl ick 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 . change from ActionScript 2.0 to ActionScript 3.0 From the Library of Wow! eBook ptg Chapter 17 Debugging a Movie 419 Control Compiler Warnings Create or open a Flash document (ActionScript 3.0). Click. 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. 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

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

TỪ KHÓA LIÊN QUAN