CoffeeScript EventDispatcher

In order to explore CoffeeScript OOP features, I decided to implement something actually usable. As an ActionScript 3 developer, I really love the event driven architecture of the language and built-in features like event dispatching. For handling events in Flash environment we have to use EventDispatcher class or subclass and Event class or subclass. Continue reading

Polish PESEL, NIP, REGON numbers validation

This class can be helpful for my polish fellows. While implementing forms you always want to do some client-side validation (with Flex you might want to write custom Validators). This utility class helps with validating polish identification numbers like PESEL (national identification number), NIP (tax identification number) or REGON (national business registry number). Continue reading

Measuring execution time

While measuring execution time, it can be boring to write getTimer() over and over again, then assign it to a variable, calculate time between start and finish of the method and in the end – assign the result to the text property of textfield so our tests can be used also in release mode (using not only trace that is visible in debug mode – btw. all tests should be taken in release mode because this is the mode we’re shipping our code:)). Continue reading

With keyword speed test

One of the most rarely used keyword in ActionScript 3 is definitely the ‘with’ keyword. Let’s see what the documentation tells us about this keyword:

Establishes a default object to be used for the execution of a statement or statements, potentially reducing the amount of code that needs to be written.

You read more about ‘with’ keyword in documentation.

This looks promising, we do love the “write less, do more” concept, but how about performance of this solution? Continue reading

Multiplication vs division

AS3 is definitely not a language for number crunching, but simple (or a little more complex) math is always with us.
When I look the places to improve performance of my code I never forget about readability of my code. This is why I’m not a fan of using bitwise operators (which are faster than multiplication and division) in my code because when working in a team, code clarity and maintainability is critical. But how about more “popular” operators like division and multiplication? Which operator is faster? Continue reading