Skip to content

ActionScript Error: Expecting semicolon before minus

One of my students came across an “expecting semicolon before minus” error while working on an ActionScript project last week.

The error totally threw the student, but it made sense to me. At least I though it did. My guess was that somewhere in the code he had accidentally put a minus where one shouldn’t have been, and best guess was a minus instead of an equals sign.

A quick look through his code and I couldn’t find anything though. Even printing it out and going through it line by line didn’t turn anything up.

Turns out, after taking more time than I’d like to admit, is one of his symbols had a minus sign in the class name. In ActionScript a minus sign isn’t a valid character for a class and that’s what was causing the error. Changing it to an underscore got rid of the error.

It would be nice if Flash was nice enough to pop up a warning when you use an invalid character in a class name. Sure, now that I’ve seen the error it’ll be pretty easy to fix next time. But it did lead to a lot of frustration for a student.

Published inProgrammingteaching

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *