Browsing the tag Flash
I just discovered a really nice thing (thanks to Pernilla) using multiple conditions (&&, ||) in the if…else conditional statement in Actionscript. The thing I did not know (you probably did) is that the statement do not check the remaining conditions when a condition is not fulfilled. If you look at the image below you can see that we get a crash on line 32 but not on line 28. This is because we add a check to see if _userVO exists before we check the contents. We also get a crash on line 38 because we check the conditions in the wrong order.

This little tip will help me save some lines of code.
Every time you change the bitmapData source for a Bitmap you also need to set the smoothing property on your Bitmap to true (if you want the bitmap to use smoothing).
var bitmap : Bitmap = new Bitmap(); bitmap.smoothing = true; trace(bitmap.smoothing); // true bitmap.bitmapData = new BitmapData(320, 240); trace(bitmap.smoothing); // false
I got some xml text line break issues in my latest project. The texts look good viewing them locally, but when uploading the project to the customer server I get a lot of extra line breaks. I am not really sure why this problem occurs but I guess it has to do with the server platform. I tried to save the xml with a different encoding but with no luck so I wrote this simple method. It works.
public function fixLineBreakIssues(value : String) : String { return value.split("\r").join(""); } // usage txtField.htmlText = fixLineBreakIssues(xmlText);
It is hard to remember the whole ASCII key list when listening to keyboard events in Flash Actionscript.
Example:
I usually use the Keyboard Class (flash.ui.Keyboard) when tracking keyboard inputs but it does not contain all the keys you may want to use. Instead of googling tables with Keyboard keycodes I made this SWF to get quick access to the codes via the KeyboardEvent (flash.events.KeyboardEvent) class.

My friend Fredrick at undefined-type.com blogged about a really smart (lazy) and easy way of merging xmlfiles.
I found these two games that I created for a flash game contest at Kirupa in 2004. Barefoot Longjump got 1st price. The highscore does not work but I might fix that later. Anyways … happy playing.
The latest release of Motor2 is using the Vectors class which means you have to compile your files for Flash player 10. If you for some reason don’t want to change to FP10, Michael (developer of Motor2) has the solution:
replace all Vector occurrences with Arrays
http://groups.google.com/group/motor2/browse_thread/thread/182291562d7dfd9a




