It’s not what you say, It’s how you say it
You may or may not know this, but Actionscript reads your code from top to bottom. You might not this this really matters at all, but it does. Today I was working on a platforming engine and alot of the collision detecting was messing up. I just rearranged some of the code and it ran just how I wanted.
I am finding a lot lately that when I am actionscripting if I change parts of my code around that my code will run a lot more smoother, or sometimes my code doesn’t work do what it is supposed to until i rearrange it. I thought it would be worth writing about this since there will be a lot of people that don’t realize this.
Here is an example of what I am trying to say:
var message:String = "Hello World";
trace(message);
//Outputs undefined
trace(message);
var message:String = "Hello World";
The first message will output ‘Hello world’, as you would expect. But the second code outputs undefined, because the string is declared after you trace it. So it doesn’t exist yet.
Think about this next time you are coding, it will make a big difference.















Ok, that is somthing I did not know…he he…Good!