Error in supported CSS properties in Flash

So actually there is not an error in the way the CSS properties are handled within Flash, if you area always in the run trying to get things done you will notice that the first column in the Flash Help file for the CSS properties has (for example) text-align. You might right away try to use the properti as such but if you look closer there is a column next to the CSS properties called ActionScript property and in there you have the defenition of how the CSS property must be handled. In the case of text-align it must be textAlign.

If it is well explained in the Docs then why did I name this Post “Error in supported CSS properties in Flash”? Good question, I was about to report this as an error until I realized it was my mistake and it was not the Docs, I just scan throu the document without paying too close attention.

With that said I believe it could be a good idea to have the compiler check for small items like that, I mean really how hard would it be to check for “text-align” in your code and prompt a warning like “Hey! you are using text-align” in your code, did you mean to use textAlign?.

heh just an idea 🙂

Using Switch and Case

Following the samples from the Flash Docs you will have the following:

[as]switch (variable) {
case 0:
trace(“Option0”);
break;
case 1:
trace(“Option1”);
break;
case 2:
trace(“Option2”);
break;
}[/as]

But if you are about to test against a string variable instead of a number variable your first instict (or at least i guess it would be your first instict) would be just to place the string inside the case statement

[as]
case thevariable;
[/as]

Once you run your code this is not going to work, granted the variable you are testing might be the exact variable you are expecting but in reallity flash won’t know it is a string until you put it in quote marks.

[as]
case “thevariable”;
[/as]

I hope this little tip helps out some of you…

ActionScript Email Validation

Sooner or later you will face with the small quest of validating an email address for your flash application. The following script is a basic script and should not be used for websites that relay heavily on the email address is being requested (shopping carts, credit card transactions and so forth)

[as]function isValidEmail(e) {
if (e.indexOf(“@”) != -1 && ( e.indexOf(“.”) > e.indexOf(“@”) ) ){
trace(“success”);
}else{
trace(“error”);
}
}

//Test
isValidEmail(“test@test.com”);
[/as]

Never Understimate the power of MovieClips used as Graphics

When the time comes when you have to develop the same set of animations for different sets and different sizes don’t forget to use your MovieClips as Graphics, this is a great way to save work for everyone.

Not only you will be able to deliver on time (and if you are lucky under schedule) but also you will be able to produce work faster and at the same time cut prices for the production. So in the end this is a Win-Win situation