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…

GoDaddy and MySQL access

If you are a developer and you do some sort of backend work there is a chance one of your clients might ask you to install an application in GoDaddy servers.

So if you are trying to connect to a dabase within your application what GoDaddy recommends is to use mysql.secureserver.net as your hostname. Maybe this could have worked while back but that information is not true for all servers.

If you are having problems all you have to do is login to your GoDaddy control panel and look what server has GoDaddy assigned for you, at least that is how it worked out for me.

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]