Archive for January, 2009

Regular Expressions

Posted in Actionscript, Flash, General on January 30th, 2009 by Sandro Haag – 2 Comments

Regular Expressions is one of the great things that Adobe has done in Actionscript 3. It simplifies the way that you do the validation of email, birthdate, cep…

Almost all programming languages have Regular Expressions, the only thing that modify, is the usage.

Here are some examples:

Email

var regExp:RegExp = /^[a-z][w.-]+@w[w.-]+.[w.-]*[a-z][a-z]$/i;
var isValid:Boolean = regExp.test(”hahahaag@gmail.com”);
trace(isValid); // true

Birthdate

This is one of the longest Regular Expression that I’ve used. It validates the birthdate perfect, including leap year.

var regExp:RegExp = /^(((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])([1-2][0,9][0-9][0-9]))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])([1-2][0,9][0-9][0-9]))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])([1-2][0,9][0-9][0-9]))|((29)(.|-|-)(02)([/])([02468][048]00))|((29)([/])(02)([/])([13579][26]00))|((29)([/])(02)([/])([0-9][0-9][0][48]))|((29)([/])(02)([/])([0-9][0-9][2468][048]))|((29)([/])(02)([/])([0-9][0-9][13579][26])))$/i;
var isValid:Boolean = regExp.test(”16/06/1986″);
trace(isValid); // true

You can find many others, searching at Google. The usage is the same.

If somebody finds others interesting RegExp, please send it to me.

Good luck!

Flash CS4 Util Tip

Posted in Flash on January 29th, 2009 by Sandro Haag – Be the first to comment

Hey!

Today I’ve accidentally found some great feature of Flash CS4. You can change the properties of some object usingĀ  the mouse wheel.

Draw a square for example, click on it, and put the mouse over the Width property at Properties Panel. The cursor will change, and you can click and drag to change the value.

Ok, now spin your mouse wheel over this property. It changes one by one pixel. Wow!

Maybe it works for another Adobe softwares.

:P

Welcome!

Posted in General on January 28th, 2009 by Sandro Haag – Be the first to comment

Well, here is another Actionscript and Flash related blogĀ  :)

I’ll try to show here, some examples, utilities, nice codes, classes, news about Flash, and more.

To start it, I’ll introduce the FFilmation, the best Actionscript 3 Isometric Engine that I’ve found (if there is another better than this one, please somebody tell me).

I needed to search some engines cause I’m using isometric world for a project. It’s a nice engine, kind’a simple to use, but it’s hard to learn it, cause there is no complete documentation, and the forum is not too used. But the creator of this engine answers you quickly.

There are few bugs, but for my project (it is a little complex) the engine works fine. And the end of this month (I hope so) a new release is about to be available, that I guess most of the problems will go away.

That’s it! :D