General

Removing a FLVPlayBack Instance

Posted in General on June 29th, 2009 by Sandro Haag – 2 Comments

Hey!

Well, remove a FLVPlayBack instance is more complicated than you can possible imagine!
If you try to remove one, just using this:
removeChild(player);
You will notice that actually the player is there, you can hear it (if it has sound, of course :P)

So, just do this:
player.getVideoPlayer(player.activeVideoPlayerIndex).close();
player.activeVideoPlayerIndex = player.activeVideoPlayerIndex + 1;
player.visibleVideoPlayerIndex = player.activeVideoPlayerIndex;

Yeap, Adobe sometimes doesn’t help us! :P

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!

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