Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
CPIT 102 CPIT 102 CHAPTER 1 COLLABORATING on DOCUMENTS.
© 2002 ComputerPREP, Inc. All rights reserved. Excel 2000: Customizing Excel and Using Macros.
“Computers and Creativity”
© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
1 Flash Actionscript Adding Interactive Actions Variables.
Kapi’olani Community College Art 258 Interface Programming II In-class Presentation Week 5A.
Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi.
JavaScript, Fourth Edition
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Visual Basic Chapter 1 Mr. Wangler.
Chapter 3 Working with Symbols and Interactivity.
SQL Maestro Hello World IQ Associates. Contents Initial setup Hello World.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
1 Flash Basics by Dr SC Li. 2 File Types  In general, Flash 5.0 generates 3 types of files:  ???.fla  Flash ’ s working file  ???.swf  Flash movie.
Chapter 2 Creating a Research Paper with References and Sources Microsoft Word 2013.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Chapter 11 Adding Sound and Video. Chapter 11 Lessons 1.Work with sound 2.Specify synchronization options 3.Modify sounds 4.Use ActionScript with sound.
© 2011 Delmar, Cengage Learning Chapter 9 Introduction to ActionScript 3.0.
Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Author: Loh Jianxiong Christopher Editors: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
Tutorial 8 Programming with ActionScript 3.0. XP Objectives Review the basics of ActionScript programming Compare ActionScript 2.0 and ActionScript 3.0.
Playing Back Scripts In HP LoadRunner >>>>>>>>>>>>>>>>>>>>>>
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Active-HDL Interfaces Debugging C Code Course 10.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
VB – Debugging Tools Appendix D. Why do we need debugging? Every program has errors, and the process of finding these errors is debugging Types of errors.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
XP Tutorial 8 Adding Interactivity with ActionScript.
Working with Movie Clips – Lesson 61 Working with Movie Clips Lesson 6.
Quick Introduction to creating Eyeblaster ads.  Steps for creating an Eyeblaster ad  Building Eyeblaster compatible flash assets  Adding Eyeblaster.
CS320n –Visual Programming More LabVIEW Foundations.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Distributed Multimedia Programming Week - 6 ActionScripts Basics and Behaviors Working with Text.
© 2011 Delmar, Cengage Learning Chapter 10 Using ActionScript to Enhance User Experience.
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
Web Page-Chapter 6 Forms. Inserting a Form  Display the Insert bar  Click the arrow to the right of the display category on the Insert bar and then.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
CIS 205—Web Design & Development Flash Chapter 3 Appendix on Using Buttons.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
© 2011 Delmar, Cengage Learning Chapter 11 Adding Sound and Video.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
15 Copyright © 2004, Oracle. All rights reserved. Debugging Triggers.
XP Tutorial 8 Adding Interactivity with ActionScript.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
 Motion Tween allow us to move a shape on the stage from one place to another.  In order to use motion tween, the shape to be moved must be converted.
Debugging with Eclipse
Excel Tutorial 8 Developing an Excel Application
Unit Lessons Work with actions
Computer Programming I
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
CIS 470 Mobile App Development
Debugging Visual Basic Programs
CIS 470 Mobile App Development
CIS 694/EEC 693 Android Sensor Programming
Presentation transcript:

Debugging tools in Flash CIS 126

Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors in a SWF file while it’s running in Flash Player. –The Output panel, which shows error messages (including some runtime errors) and lists of variables and objects (see Using the Output panel)Using the Output panel –The trace statement, which sends programming notes and values of expressions to the Output panel (see Using the trace statement)Using the trace statement –The throw and try..catch..finally statements, which let you test and respond to runtime errors from within your scriptthrowtry..catch..finally

Debugger Tool You must view your SWF file in the Flash Debug Player. –Installed by default The Debugger shows a hierarchical display list of movie clips currently loaded in Flash Player. Using the Debugger, you can display and modify variable and property values as the SWF file plays, and you can use breakpoints to stop the SWF file and step through ActionScript code line by line.

Debugger Tool You can use the Debugger in test mode with local files, or you can use it to test files on a web server in a remote location. The Debugger lets you set breakpoints in your ActionScript that stop Flash Player and step through the code as it runs. You then go back to your scripts and edit them so that they produce the correct results.

Debugger Tool After it’s activated, the Debugger status bar displays the URL or local path of the file, tells whether the file is running in test mode or from a remote location, shows a live view of the movie clip display list. – When movie clips are added to or removed from the file, the display list reflects the changes immediately.

Debugger Tool To activate the Debugger in test mode: –Select Control > Debug Movie. This command exports the SWF file with debugging information (the SWD file) and enables debugging of the SWF file. It opens the Debugger and opens the SWF file in test mode.

Debugger Tool

Displaying and modifying variables The Variables tab in the Debugger shows the names and values of any global and Timeline variables in the SWF file selected in the display list. If you change the value of a variable on the Variables tab, you can see the change reflected in the SWF file while it runs. –For example, to test collision detection in a game, you can enter the variable value to position a ball in the correct location next to a wall.

Locals Tab The Locals tab in the Debugger shows the names and values of any local variables that are available in the line of ActionScript where the SWF file is currently stopped, at a breakpoint or anywhere else within a user-defined function.

Displaying Variables To display a variable: 1.Select the movie clip containing the variable from the display list. To display global variables, select the _global clip in the display list. 2.Click the Variables tab.

Variables The display list updates automatically as the SWF file plays. If a movie clip is removed from the SWF file at a specific frame, that movie clip, along with its variable and variable name, is also removed from the display list in the Debugger. –However, if you mark a variable for the Watch list the variable is removed from the Variables tab, but can still be viewed in the Watch tab.

Variable Tab

Modifying a Variable To modify a variable value: –Double-click the value, and enter a new value. The value cannot be an expression. For example, you can use "Hello", 3523, or " and you cannot use x + 2 or eval("name:" +i). The value can be a string (any value surrounded by quotation marks [""]), a number, or a Boolean value (true or false).

Using the Watch List To monitor a set of critical variables in a manageable way, you can mark variables to appear in the Watch list. The Watch list shows the absolute path to the variable and the value. You can also enter a new variable value in the Watch list the same way as in the Variables tab. – The Watch list can show only variables and properties that can be accessed by using an absolute target path, such as _global, _root.

Using the Watch List 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, the value is listed as undefined. The Watch list can show only variables, not properties or functions.

Variable list vs Watch List

Adding Variables to the Watch List To add variables to the Watch list: –On the Variables or Locals tab, right-click (Windows) or Control-click (Macintosh) a selected variable and then select Watch from the context menu. A blue dot appears next to the variable. –On the Watch tab, right-click (Windows) or Control- click (Macintosh) and select Add from the context menu. Double-click in the name column, and enter the target path to the variable name in the field.

Removing variables from the Watch List On the Watch tab, right-click (Windows) or Control-click (Macintosh) and select Remove from the context menu.

Displaying movie clip properties and changing editable properties The Debugger’s Properties tab shows all the property values of any movie clip on the Stage. You can change a value and see its effect in the SWF file while it runs. Some movie clip properties are read-only and cannot be changed.

To display a movie clip’s properties in the Debugger: Select a movie clip from the display list. Click the Properties tab in the Debugger.

Properties Display

To modify a property value: Double-click the value, and enter a new value. –The value cannot be an expression. For example, you can enter 50 or "clearwater", but you cannot enter x The value can be a string (any value surrounded by quotation marks [""]), a number, or a Boolean value (true or false). You can’t enter object or array values (for example, {id: "rogue"} or [1, 2, 3]) in the Debugger.

Setting and removing breakpoints A breakpoint lets you stop a SWF file running in Flash Player at a specific line of ActionScript. You can use breakpoints to test possible trouble spots in your code. –For example, if you’ve written a set of if..else if statements and can’t determine which one is executing, you can add a breakpoint before the statements and step through them one by one in the Debugger.

Setting Breakpoints You can set breakpoints in the Actions panel or in the Debugger. –To set breakpoints in external scripts, you must use the Debugger while in a debugging session. Breakpoints set in the Actions panel are saved with the FLA file. Breakpoints set in the Debugger are not saved in the FLA file and are valid only for the current debugging session.

Breakpoint Caution If you set breakpoints in the Actions panel and press the Auto Format button, you might notice that some breakpoints are no longer in the correct location. ActionScript might be moved to a different line when your code is formatted because sometimes empty lines are removed. It might be necessary to check and modify your breakpoints after you click Auto Format, or to auto format your scripts before setting breakpoints.

To set a breakpoint in the Actions panel Click in the left margin. A red dot indicates a breakpoint. Click the Debug options button above the Script pane. Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select Set Breakpoint, Remove Breakpoint or Remove All Breakpoints. Press Control+Shift+B (Windows) or Command+Shift+B (Macintosh).

To set and remove breakpoints in the Debugger: Click in the left margin. A red dot indicates a breakpoint. Click the Toggle Breakpoint or Remove All Breakpoints button above the code view. Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select Set Breakpoint, Remove Breakpoint, or Remove All Breakpoints. Press Control+Shift+B (Windows) or Command+Shift+B (Macintosh).

Break points After Flash Player stops at a breakpoint, you can step into, over, or out of that line of code. (See Stepping through lines of code.)Stepping through lines of code Note: Do not set breakpoints on comments or empty lines; if breakpoints are set on comments or empty lines, they are ignored.

Stepping through lines of code When you start a debugging session, Flash Player is paused so that you can toggle breakpoints. If you set breakpoints in the Actions panel, you can simply click the Continue button to play the SWF file until it reaches a breakpoint. If you didn’t set breakpoints in the Actions panel, you can use the jump menu in the Debugger to select any script in the SWF file. When you have selected a script, you can add breakpoints to it.

Starting the Process After adding breakpoints, you must click the Continue button to start the SWF file. The Debugger stops when it reaches the breakpoint.

Looking at a break Point For example, in the following code, suppose a breakpoint is set inside a button on the line myFunction(): on(press){ myFunction(); } When you click the button, the breakpoint is reached and Flash Player pauses. You can now step in to bring the Debugger to the first line of myFunction() wherever it is defined in the document. You can also step through or out of the function.

Stepping through the code As you step through lines of code, the values of variables and properties change in the Watch list and in the Variables, Locals, and Properties tabs. A yellow arrow on the left side of the Debugger’s code view indicates the line at which the Debugger stopped. Use the following buttons along the top of the code view:

Control Buttons Step In advances the Debugger (indicated by the yellow arrow) into a function. Step In works only for user- defined functions. Step Out advances the Debugger out of a function. Step Over advances the Debugger over a line of code. Continue leaves the line at which the player is stopped and continues playing until a breakpoint is reached. Stop Debugging makes the Debugger inactive but continues to play the SWF file in Flash Player.

The Output panel In test mode, the Output panel shows information to help you troubleshoot your SWF file. Some information (such as syntax errors) appear automatically. You can show other information by using the List Objects and List Variables commands.

The Output Panel To display or hide the Output panel, select Window > Development Panels > Output or press F2.

Output Panel and Trace If you use the trace statement in your scripts, you can send specific information to the Output panel as the SWF file runs. This could include notes about the SWF file’s status or the value of an expression.

Listing a SWF file’s objects In test mode, the List Objects command shows the level, frame, object type (shape, movie clip, or button), target paths, and instance names of movie clips, buttons, and text fields in a hierarchical list. This is especially useful for finding the correct target path and instance name. Unlike the Debugger, the list does not update automatically as the SWF file plays; you must select the List Objects command each time you want to send the information to the Output panel.

List Objects Caution: Selecting the List Objects command will clear any information that currently appears in the Output panel. If you do not want to lose information in the Output panel, select Save to File from the Output panel Options pop-up menu or copy and paste the information to another location before selecting the List Objects command.

List Objects The List Objects command does not list all ActionScript data objects. In this context, an object is considered to be a shape or symbol on the Stage.

To display a list of objects in a SWF file: If your SWF file is not running in test mode, select Control > Test Movie. Select Debug > List Objects. –A list of all the objects currently on the Stage appears in the Output panel