View Full Version : Check Syntax vs. Auto Format
sophistikat
06-29-2006, 03:09 PM
i've been going through some of my clients actionscript files and there are some files in which i get The script contains no errors when i select 'Check Syntax' but when i click on 'Auto Format' i get The script contains syntax errors, so it cannot be Auto Formatted. Fix the errors and try again.
1. who's right?
2. can the actionscript execute properly when we see these messages?
3. what is flash checking with each button?
mooska
06-29-2006, 03:24 PM
function myFunction()//some comment
{
function body
}
//or
Array(//comment
"blabla",
"blablabla"
);
Remove the comment in situations like this, and should be ok.
sophistikat
06-29-2006, 03:39 PM
i think you where going forfunction myFunction () //some comment
{
function body () {
}
//or
Array ( // comment
"blabla", "blablabla"
);
}...which gives me both messages; i've ran into this before but i wanted to double check i was right.
is this the only situation or are there others?
mooska
06-29-2006, 03:46 PM
Not egzactly.
If you`ll place comment between two signs that after autoformatting should be in one line (like between () and { in function syntax) youll get that kind of situation, because it is impossible to get them into one line if there is a comment.
sophistikat
06-29-2006, 03:50 PM
i found a sample .as file where with or without comments you still get the same situationimport mx.events.EventDispatcher;
import net.pgicorp.util.tilt.*;
class net.pgicorp.controllers.TiltController extends MovieClip {
private var tiltMsgs:MessageTilts;
private var tiltDoors:DoorTilts;
public function TiltController() {
EventDispatcher.initialize(this);
hideAll();
}
private function hideAll():Void {
this.tiltMsgs._visible = false;
this.tiltDoors._visible = false;
}
public function dispatchEvent() {};
public function addEventListener() {};
public function removeEventListener() {};
public function registerEvent(event:String, targetListener:Object):Void {
this.tiltMsgs.registerEvent(event, targetListener);
}
public function removeEvent(event:String, targetListener:Object):Void {
this.tiltMsgs.removeEventListener(event, targetListener);
}
public function tiltMessageExist():Boolean {
return this.tiltMsgs.tiltMessageExist();
}
public function tiltDisplayRequestEvent(event:Object):Void {
this.tiltMsgs.tiltDisplayRequestEvent( event );
this.tiltDoors.tiltDisplayRequestEvent( event );
}
}can you see what i can't?
senocular
06-29-2006, 03:54 PM
the checks in the AS panel are not related to compilation. They can say there's errors simply because they might not recognize a coding style or certain usages, however the script may still compile. They should not be used to check against possible compilation errors. You simply need to compile for that.
... and really, Im not sure that they added AS2 support for those things
mooska
06-29-2006, 04:03 PM
Well, it works for me
import mx.events.EventDispatcher;
import net.pgicorp.util.tilt.*;
class net.pgicorp.controllers.TiltController extends MovieClip {
private var tiltMsgs:Object;
private var tiltDoors:Object;
public function TiltController() {
EventDispatcher.initialize(this);
hideAll();
}
private function hideAll():Void {
this.tiltMsgs._visible = false;
this.tiltDoors._visible = false;
}
public function dispatchEvent() {
}
public function addEventListener() {
}
public function removeEventListener() {
}
public function registerEvent(event:String, targetListener:Object):Void {
this.tiltMsgs.registerEvent(event, targetListener);
}
public function removeEvent(event:String, targetListener:Object):Void {
this.tiltMsgs.removeEventListener(event, targetListener);
}
public function tiltMessageExist():Boolean {
return this.tiltMsgs.tiltMessageExist();
}
public function tiltDisplayRequestEvent(event:Object):Void {
this.tiltMsgs.tiltDisplayRequestEvent(event);
this.tiltDoors.tiltDisplayRequestEvent(event);
}
}
Maybe someting with imported class ? Hard to tell.
//I`ve replaced you classes with Object
shane.carr
07-23-2006, 12:50 AM
I had the same problem, and it was solved when I removed the comment from this code:
new Array(function(){
trace("do this")
}, function(){
trace("do that")
}/*, function(){
trace("do another thing")
}*/)
CyanBlue
07-26-2006, 09:59 PM
Very interesting... :)
uncleunvoid
07-15-2008, 03:43 PM
just to update on this one,
I tend to write simpler or no comments and I m getting the same anomaly, which i very frustrating and CS3 seems to tend to just come up with stuff.
e.g. I had one where it just stopped loading classes, saying it cant load them , i restarted flash and it was fine.
its the same with the stealing of brackets when auto formatting, it sometimes does it.
seems to me the auto formatting is more similar to AS3 so when you code AS2 all sorts of funny thing shappen
another shame on the Flash dev crew, at least they get the maths right most of the time these days...
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.