Skip to main content
Inspiring
May 1, 2007
Question

Reality Check: Flash CS3/AS3 Check Syntax

  • May 1, 2007
  • 27 replies
  • 2789 views
I need a quick reality check. I've finally started playing around in CS3/AS3 on my Mac. Whenever I click "check syntax" I get a very limited error response: specifically, I get actual syntactical errors (e.g., a missing brace or paren), but I get NO COMPILER ERRORS (e.g., use of an undefined method or property). These compiler errors trigger at runtime, but not having them during authoring makes coding and debugging unnecessarily difficult.

Is this really how it's supposed to work?

In Flash8/AS2, we had compile-checking right in the AS file. If I attempted to access an undefined method or property, the error-checker would catch that right away. No time-consuming compile was necessary to catch these obvious errors (see example below). But AS3 doesn't seem to be as clever.

Am I missing something?

Thanks much!

-------------EXAMPLE---------------
This topic has been closed for replies.

27 replies

Inspiring
May 16, 2007
I've posted a comment to LiveDocs on this issue at:
http://livedocs.adobe.com/flash/9.0/UsingFlash/help.html?content=WS3e7c64e37a1d85e1e229110db38dec34-7fd0.html

It's not visible yet (I presume these things get checked by Adobe for content), but I'm hoping to keep the fire burning, at least until we get some sort of feedback that a patch is planned.
Inspiring
May 14, 2007
Thank you.
Inspiring
May 14, 2007
I am not entirely sure that syntax checking alone in AS3 is as complete as
it could be. A lot of that responsibility seems to be left to the compiler.
Given that the return issue does work with AS2, however, and not AS3, it
does seem incomplete. I will log a bug on the issue.

"Rothrock" <webforumsuser@macromedia.com> wrote in message
news:f2a0hs$ag6$1@forums.macromedia.com...
> Trevor ? can you confirm if there is SUPPOSED to be syntax checking in
> AS3? Is
> this something that IS working for some folks? Or was the decision somehow
> made
> to not have any syntax checking and push everything to compile time check?
>
> If this is how it is supposed to be then I'll just have to learn to accept
> it.
> I guess?
>


Inspiring
May 14, 2007
Trevor – can you confirm if there is SUPPOSED to be syntax checking in AS3? Is this something that IS working for some folks? Or was the decision somehow made to not have any syntax checking and push everything to compile time check?

If this is how it is supposed to be then I'll just have to learn to accept it. I guess…
Inspiring
May 13, 2007
Stwigy that doesn't make sense to me. Because it is not giving errors for anything. Lets take this example:

var A:Number=5;;
var B:String="hello world";
A=B;
trace(A);

The syntax check says this is just fine. If I compile it I get a warning, but it doesn't coerce or cast anything, it just stops the program from compiling. Or the other one that is bugging i me is a function that is supposed to return a value, but I've not set a return statement. Again it is caught during compile time, but I think the syntax checking button should actually do something.

Trevor – And yes, strict mode is enabled.

I guess the big issue is that I'm used to using the syntax check to find these kinds of errors and not used to having to wait until compile time to see these errors. I find it a step down in ease of use and convenience. Especially if I am developing a class. The need to make another swf that instantiates the class and have to have it going at the same time is a hassle.

I like to work like this.

Type up a function/method.
Check syntax – whoops fix the couple things.
Type up the next function/method
Check syntax – Oh I forgot the return.
etc.

Under AS2, this was very easy. Having to compile is a bit more involved and just breaks my established rhythm. Maybe I'll get used to it, who knows. But with the tonnes of other things I'm having to learn with AS3 that is making it quite an unpleasant experience.
Participant
May 13, 2007
Rothrock is right, it goes way beyond type casting. It doesn't even catch basic syntax errors. I first discovered the issue when I was writing a class file. I defined a variable with "var" but later on misspelled the variable. The Syntax Check didn't catch it, I only got an error when I compiled, much later in the process. So the only explanation for the Syntax Check not catching it is that it assumed I was trying to use a new variable (one that was not previously defined )... but in a class, this is illegal, no matter how you try to justify it.

quote:

Originally posted by: Rothrock
Especially if I am developing a class. The need to make another swf that instantiates the class and have to have it going at the same time is a hassle.



Agreed. I've also worked on large projects where compile times can be close to a minute. it doesn't make sense to have to compile a swf just to catch a typo, especially since the syntax check was a feature we already had! Why make it less convenient at this point?

If a class file or a piece of code contains an error such that ANY fla file that uses it under ANY context will throw an error, shouldn't the Syntax Check be able to catch that? What is the point of only flagging an error at compile time if the nature of the error is completely independent of the compile process?

J

Inspiring
May 13, 2007
Make sure strict mode is enabled in your publish settings (Flash tab, AS3
settings)

"Rothrock" <webforumsuser@macromedia.com> wrote in message
news:f20on9$8mg$1@forums.macromedia.com...
> Okay it has been a bit, but today's outrage.
>
> function test():Number {
> var something:String="thing";
> }
>
> Should tell you that you've forgotten the return statement ? under AS2 it
> does. It should also tell you if you tried to return something it should
> then
> tell you the type doesn't match.
>
> (I know this is all part of the same thing, but I'm just so stunned by the
> lack of syntax checking is AS3 and I sometimes don't know when to stop
> flogging
> a deceased equine!)
>


Inspiring
May 11, 2007
Thanks. Eventually maybe we will hear something. My guess is going to be that they put it into the compile time warnings and that is what we are going to get.

How this ever got to be a decision is beyond me.
May 13, 2007
it does not give errors for some of these mismatch errors simply because it assumes that the programmer wishes to convert/cast the variable to another type.
More info
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000048.html
Inspiring
May 11, 2007
Okay it has been a bit, but today's outrage.

function test():Number {
var something:String="thing";
}

Should tell you that you've forgotten the return statement – under AS2 it does. It should also tell you if you tried to return something it should then tell you the type doesn't match.

(I know this is all part of the same thing, but I'm just so stunned by the lack of syntax checking is AS3 and I sometimes don't know when to stop flogging a deceased equine!)
Participant
May 11, 2007
I stumbled upon this "feature" and had to google it to make sure i wasn't crazy. I came upon this thread and I'm a little surprised by the lack of feedback from Adobe on this issue. I submitted a bug report though. I hope that gets their attension.
Inspiring
May 9, 2007
I'll check again, but I'm pretty sure that was one of the first things I thought of. It took me quite a merry chase to find where I had seen that check box!
May 8, 2007
I'm not in front of Flash CS3 at the moment, but try turning strict mode on, I believe Flash CS3 ships with it off by default. It's in the publish settings I believe.

Welcome to the world of alienated web developers and designers. AS3 was designed for us.