Short hand for If Statement

a = b ? true : false; a == b ? (true1, true2) : false

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 […]

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 […]

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 […]

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) […]

createTextField and removeTextField

[as]createTextFieldOnce = function(){ trace(“—> Text Field Created”); _root.createTextField(“cMagnitude”,this.getNextHighestDepth(),0,0,100,30); cMagnitude.text = “Hello World”; }; deleteTextField = function(){ trace(“—-> Text Field Deleted”); _root.cMagnitude.removeTextField(); }; createTextFieldOnce(); setInterval(deleteTextField,1000);[/as]

Loading a RSS feed into Flash

[as]// create a new XML object var sports:XML = new XML(); // set the ignoreWhite property to true (default value is false) sports.ignoreWhite = true; // After loading is complete, trace the XML object sports.onLoad = function(success) { trace(sports); }; // load the XML into the sports object sports.load(“”);[/as]

Removiing a Movie Clip on Stage with AS

[as]//A square with id = square //A simple button named mca that removes the attached MCs this.attachMovie(“square”, “square1”,1); this.attachMovie(“square”, “square2”,2); square2._x =100; mca.onRelease = function() { square1.removeMovieClip(); square2.removeMovieClip(); }[/as]