Mar
Wed
17
my switch and for statements doesnt work anymore after autoformat, it adds ';' where it shouldnt..
Anyone ? Please ?
You seem pretty excited, sen. Let me get this straight- you were able to reproduce all these auto-format oddities, by associating an actionscript file with an AS2 Flash file? Or do you mean that you were able to reproduce Macsy's issue? Or what?
autoformat did work, for a lot of time, but... Suddenly, after 3000 formats;
"HEY! I know what i can do, i can destroy your code*evil*"
My auto-format settings are,
Inserting { after function, class, and interface keywords,
Inserting spaces around operators, and
Don't format multiline comments.
I just turned the last one off, and the issue with the comments shifting has disappeared. (I guess I'll leave that one off for now.) The semicolon issue still pops up, and the weird constructors still occur. In fact, if I have a constructor with no parentheses following it, Auto Format will add two spaces to the end rather than two parentheses.
EDIT: Speaking of Auto Format settings, the "put spaces around operators" setting doesn't put spaces around my assignment-related operators like "=" and "+=". Is it meant to be that way?
I should add that my Mac's PowerPC-based, in case that has any implications.
Please quote me!
Did reinstalling work Rezmason?
I go to my school and import the AS into Fla MX 2004 , Hope it will solve...
For instance, I have a Main class that I've made public final, and it formats this:
public final class Main extends Editor {
// class stuff
}
into this!
public final class Main extends Editor {;
// WTF?
}
It's not even valid code! And heaven forbid you're like me and use curly braces in your switch statements:
switch (something) {
case 1: {
// do thing 1
break;
}
case 2: {
// do thing 2
break;
}
default: {
// do default
}
}
You know what it does to that code? It does this!
switch (something) {
case 1: {
// do thing 1
break;
}
case 2: {
// do thing 2
break;
}
default: {
// do default
}
}
Each time you hit Auto Format, it'll add another blank line in there. And these are just a few stupid examples.
trace(i);
}
Works perfectly...
for(i=0;i<100;i++){
trace(i)
}
will end upp with the output: 100
Nothing else, not 1,2,3,4,5,6//
weird?
http://www.senocular.com/flash/tutorials/as3withflashcs3/#events
(you'll have to scroll around to find it because the almighty sen hasn't created an 'events' anchor :P)
//this goes...
weird = function ()
{
//blah
}
//into this:
weird = function ();
{
//blah
}
Whyyy damnit?! Anyone who can post a script file? I can later on...
example:
MovieClip.prototype.easeY = function(to) {
this.onEnterFrame = function() {
this._y = to-(to-this._y)/1.1;
if (this._y > to-1 && this._y < to+1) {
this._y = to;
delete this.onEnterFrame
//do other stuff here, this is the point at which the object reaches its target
}
}
};
mainStage.button.onRelease = function() {
mainStage.stageBottom.easeY(100);
};
when it should be:
MovieClip.prototype.easeY = function(to) {
this.onEnterFrame = function() {
this._y = to-(to-this._y)/1.1;
if (this._y > to-1 && this._y < to+1) {
this._y = to;
delete this.onEnterFrame
//do other stuff here, this is the point at which the object reaches its target
}
}
};
mainStage.button.onRelease = function() {
mainStage.stageBottom.easeY(100);
}
Like I said, these don't always happen (well, the switch statement one does for me), which makes it hard to demonstrate.
EDIT: Here, try auto-formatting this:
package net.rezmason.BitmapEditor
{
public final class Main extends Editor
{
public function Main():void
{
}
}
}
That one should cause the weird semicolon bug. And here's another bug I'm experiencing:
// before auto-formatting:
package net.rezmason.BitmapEditor
{
public final class Main extends Editor
{
}
}
// and after:
package net.rezmason.BitmapEditor
{
}
}
public final class Main extends Editor;
Nothing else, not 1,2,3,4,5,6//
weird?
Try
for(var i:Number=0;i<100;i++){
trace(i);
}
EDIT: No dice. I'm going to try these things on another Mac as well.
Here, I'm going to upload the class that the code above was in. It's one of my favorite classes, actually.
...
Here's the link to the zip file. (http://homepage.mac.com/rezmason/BMPMotleyBrush.as.zip) Auto-formatting this class has exhibited most of the bugs I've written about at one time or another. The code whose operator precedence was messed up is on lines 50 through 55.
// before:
xa = (xArray[0] + xArray[9]) / 2;
// after:
xa = xArray[0] + xArray[9] / 2;
Christ on a bike. And it did this several times throughout my class just now.
NOTE: You know, sen, I feel like an ***, and if all this wasn't actually happening this would be a really mean joke that I wouldn't wish on anybody. Sorry to put it all in your lap. I think the rest of Flash CS3 is awesome, if that helps soften the blow. :thumb2:
It seems to be the prototype. How would the "golden formula" be migrated to AS 3.0?
ok, I already read, that 'word on the street' is not using autoformat at all, but in most cases, autoformat works fine - at least for me.
I also think, that autoformating errors are not very reproduceable, because they do not really depend on the code, but on some other meta information saved along with the code internally.
my errors came from a completely corrext function, which was named:
myFunction = function(myParams:Array):Void
{
// something usefull in here; switch and case, etc.
}
autoformat appended semicolons on all switch and case statement inside and after the Void in the function line, which obviously breaks the code.
i made sure that there really was no error in the code, so I startet to play arround with the function line and rewrote it to:
function myFunction(myParams:Array):Void
{
// something usefull in here; switch and case, etc.
}this way, autoformating worked (even if there where some semicolons removed).
so, again I rewrote the function line to:
myFunction = function(myParams:Array):Void
{
// something usefull in here; switch and case, etc.
}yes, they same is before!
guess what?
autoformating is still working.
this is, why I think that there is some metainformation saved along with the code.
but maybe it's only on my system.
hope it helps anyway.
----8<----
krck
Meanwhile, yours is completely rewriting your code. That's nuts!
You seem pretty excited, sen. Let me get this straight- you were able to reproduce all these auto-format oddities, by associating an actionscript file with an AS2 Flash file? Or do you mean that you were able to reproduce Macsy's issue? Or what?
Just your last one. I've been working on these things since you mentioned them in that other thread. I never would have thought having an FLA open (which I normally always do) would have any bearing on how auto format worked. I will probably try the other issues again without FLA's to see if I can get those as well, but its getting late and I need to get out of here ;)
And this one I'm on the fence about, but when you use /* and */ to comment out something, the commented text should retain the level of indentation as the code around it, right? Because right now, Flash will turn this:
if (something) {
/*comment
blah
blah
blah*/
}
into this:
if (something) {
/*now
it's
over
here*/
}
EDIT: Wait! There's one more!
//When you write this:
var s:SomeClass = new SomeClass();
// it turns it into this:
var s:SomeClass = new SomeClass ;
// Notice the spaces.
for (j = 0; j < map.length; j++);
just gives j = 10
That SUCKS!!! Im so angry!!!
Ive tried other switch statements and made other functions.. they work, but CS3 HATES this function, this functions is made on 5 line, just some variables above...
createMap = function (map)
{
_root.attachMovie('tempMap','tempMap',this.getNext HighestDepth());
for (j = 0; j < map.length; j++);
{
for (i = 0; i < map[j].length; i++);
{
switch (map[j][i])
{
case 0 :;
mapDraw = "black";
tempMap.attachMovie ("white",'tile' + i + j,tempMap.getNextHighestDepth ());
tempMap["tile" + i + j].tileWalkable = true;
break;
case 1 :;
tempMap.attachMovie ("black",'tile' + i + j,tempMap.getNextHighestDepth ());
tempMap["tile" + i + j].tileWalkable = false;
break;
};
tempMap["tile" + i + j]._x = i * 100;
tempMap["tile" + i + j]._y = j * 100;
};
};
};
createMap (map1);
Now there is no errors, but i get j = 10 at once... GRR!!!
(and maybe the PowerPC thing has something to do with it; Ive only been testing on a Mac intel)
I guess i'm lucky :D
#If you have any other info about this subject , Please add it free.# |
- edit