Macromedia Flash 5
1
2
5
6
             

Steps to Debugging
1. Recognizing and reproducing a problem
2. Identifying the source of the problem
3. Fixing the problem

Common bugs or mistakes in ActionScript

1. Code is in the wrong Place
You must remember that ActionScript should always be attached to a "frame, button, or movie clip". Also, you have to make sure that your code is attached correctly to what you want and you can do that by observing the title of the ActionScript panel. When attaching code to a frame, the ActionScript panel's title should reads "Frame Action" and when attaching code to a button or movie clip, the Action panel title should reads
"Object Action".

2. Missing event handler
When code is attached to a button or movie clip it must contain an event handler.
Movie clip code example:
onClipEvent (event){
//here is placing for your statement
}
Button code example:
on (event){
// here is placing for your statement
}

3. Wrong Movie clip reference
You must check that all instance of your movie clip have been correctly named, and the instance names match the reference.

4. Missing semicolon at the end of a statement.

5. Incorrect use of text field data usage
A text field is always treated as a number or other datatype not a string, on the other hand user input in text fields is always a string value and should be converted manually.

6. Incorrect capitalization
Remember that some keywords are case sensitive in ActionScript.
For example "onclipevent" instead of "onClipEvent", in this case ActionScript might think you are trying to call a custom function which is name "onclipevent" instead of "onClipEvent" handler keyword.

7. Scope problem, meaning a variable, property, clip, or function is referenced in the wrong place.

8. Content not yet loaded

9. Global function versus method since some global functions have the name as movie clip methods.

Debugging methods

1. In normal mode, the code will appear in red if there is a syntax problem
2. In export mode, switch to normal mode and the error will appear
3. Use the debugger. You have to enable it from inside the publish setting and then right click on the stage while the movie is running. Remember that you must change the code directly in the movie.
4. Use the Movie Explorer which shows the layout of the entire movie.



Webmaster:
sherry_montoya@westvalley.edu
Last updated 25 February 2002
©Copyrighted 2002. All Rights Reserved.

 

Trademarks Books Links home student profile wvdg