00:00
00:00
Newgrounds Background Image Theme

zombieplush just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Autoformat Error As3

822 Views | 3 Replies
New Topic Respond to this Topic

Autoformat Error As3 2010-06-27 01:22:49


Whenever I use AutoFormat I get an error "Error with AutoFormat near line "} else if (nFall < -5) {"

I've narrowed it down, whenever I use a negative number in an IF statement, I get that error.

I've used them before, but the error just began happening recently.

WTF!???!?

The full code is below,

if (nFall<9.5) {
		this.y-=10;
	} else if (nFall < ( -5)) {
		this.y-=5;
	} else {
		nFall=0;
	}

Response to Autoformat Error As3 2010-06-27 01:38:43


The auto-format does have it's problems, unfortunately there is no fix as far as I know. But on the plus side the only problem is with auto-format not your code. If you really feel the need to use the feature on your code there are a few options you can do.

1. Make the number positive before auto-format then once auto-formatted return to negative.

2. Multiply the number by 1, the 1 has to be first though so "1*-5" to keep the negative from being the first operator after the less than symbol.

3. Use variables instead of hard-coded values.


.

BBS Signature

Response to Autoformat Error As3 2010-06-27 01:46:06


At 6/27/10 01:38 AM, Fion wrote: 2. Multiply the number by 1, the 1 has to be first though so "1*-5" to keep the negative from being the first operator after the less than symbol.

You can also do " 0-5 " instead.


asdfg

BBS Signature

Response to Autoformat Error As3 2010-06-27 02:06:46


Even "0 - 5" caused an error, still don't know why :(
I ended up replacing all the values with variables. Bit of a pain but it's better for balancing and workflow anyway.

See? It all works out in the end!