Main Content

You are here:

Debugging: Compiler errors

Hello and welcome to this free ActionScript tutorial, where we will be discussing how to fix and get more information about the most common compiler (syntax) errors in ActionScript 3. If you don't know what I'm going on about, you might want to have a look at the previous tutorial about the categories of errors you can get. So, here are my top tips regarding compiler errors:

1. Look for the obvious

Most errors give a short description and decent line numbers. From this it is reasonably easy to solve the problem, because the vast majority of problems will be little things, such as missed brackets. What have you altered since the last time it compiled (and worked)? Check that section of your code and look for the obvious things.

2. Find out where the problem is

Assuming you haven't been given a good line number, and you still can't find out where the problem physically is, comment lines out, and see whether the problem still exists. Revoke recently made changes or comment them out - does it still come up with that compiler error.

3. Research your problem

The internet is a great place for finding more information about your error(s). For example, by reading this, you have probably found more information about errors. The key bit of information you will need to know when you search online is given to you in the compiler error box (see below): the number of the error concerned. In this case, the errors are numbered 1083 and 1084.

Two compiler errors

Once you have this number, you can reference it against the official Adobe list of compiler errors, which is on the . It has a great big table, and gives some long descriptions for common errors, such as my two: 1083 and 1084. 1083 is listed as:

The line of code is missing some information. In the following example, some expression (such as another number) needs to be included after the final plus sign:
var sum:int = 1 + 2 + ;

1084 also has an extended description, to help you find out what's wrong:

The expression was unexpected at this point. If the error says "Expecting right brace before end of program," a block of code is missing a closing brace (}).
If the error says "Expecting left parenthesis before _," you may have omitted a parenthesis from a conditional expression, as shown in the following example, which is intentionally incorrect...

Also note the 'comments' section of that page, which has a great link for more information about error 1046:

4. Google it

Other search engines are available, but you know what I mean. There are literally loads of ActionScript programmers, and one of them will have had the same problem as you. He or she might have posted in a forum or a blog and explained their way of fixing the error.

And finally...

Undo, undo, undo -
Go backwards until you reach a point where you didn't have the error, and start again from there, if it's not too time consuming.
Get others to look at it -
or walk away and come back later with fresh eyes.
Email us -
We're always happy to have a look for you. You can use the contact page (contact.php), or the IM chat to the right hand side of all pages. We're always happy to help or advise.

Don't worry, it'll be worth it in the end!