I have been away from Flash Builder and Flex for a little while now so I am catching up on some new features. I have 2 upcoming mobile projects to work on so this is a really great chance for me to get caught up with what has been going on. I have to say the improvements made to Flash Builder and the Flex framework are just flat out amazing. It truly is an enjoyable platform to develop applications on and I hope I have a lot more projects to work on in the future.
This is just a quick tip and most of you probable already know this but I thought I would share it anyways. Code templates speed-up your coding efforts by letting you auto-insert frequently used coding patterns. You can think of them like snippets but to me they are so much better. There are code templates for ActionScript, CSS, MXML and Flash Builder. To use a code snippet simply type the name of the snippet and hit cntrl+space. Templates can use template variables and to me this is what sets them apart from snippets. A template variable is defined within ${}. The variable is resolved based on the corresponding variable definition in the editor. In the case of the for each loop you can tab from index to array to cursor and your inside the loop. Until you really play with this you can't truly appreciate how great it is.
As I stated earlier you can also setup code templates for Flash Builder. This really comes into play when flash builder generates some boiler plate code. I love the fact that you can generate event handlers and to me this is a great time saver. Below is an example of a generated handler in a sample application I wrote yesterday.
Now this is great but something really bothers me with it. I really have OCD when it comes to my code formatting. If code is not formatted a certain way I feel the need to fix it to my liking. I know its pretty odd but I am know I am not alone. I would always generate the handler and then bring that first curly brace up to the line of the method name so it looked like this.
Not a big deal but again I was wasting time on something until I realized yesterday that I could format the generated event handler.

You will see a template for event handler. From here you can simply move the curly brace up a line and any generated event handler will now follow your preferences. I ended up making a lot of changes to code templates and added a couple of my own. I would not want to do this on every install of Flash Builder. Luckily they have given you a way to export and import code templates. Just another big kudos to the Flash Platform team. These products have come a long way.
