This task is one I seem to be doing repeatedly, so here is a snippet for all the world to enjoy.
import flash.geom.ColorTransform;
private function tint(c:Number, obj:*) {
var myColor:ColorTransform = obj.transform.colorTransform;
myColor.color = c;
obj.transform.colorTransform = myColor;
}
tint(0xffcc00, myMovieClip);
Sometimes in flash you need to get an XMLList from tags while ignoring tag case.
<xml>
<tagName>contents</tagName>
<TAGNAME>contents</TAGNAME>
</xml>
I have a class that extracts XHTML from the page where a swf is embeded. Works great except different browsers return different case for tags. Below is the snippet I used to get a node list no matter the tag case. [...]
A nifty AIR app for creating, printing, and editing a GAIA framework site.xml file.
Originally posted/get it here
Posted on January 4, 2009, 4:41 pm, by Brian, under
Uncategorized.
Had the need to validate an email address in Actionscript 3 recently. I have always copied and pasted regular expressions before. I took the time and learned them (the as3 implementation anyway). Below is a function using an email validation regex and an example swf along with the source.
function isValidEmail( str:String ):Boolean {
[...]
Posted on December 24, 2008, 12:36 pm, by Brian, under
Flash.
I recently needed to have a movieclip go black and white on rollover. ColorMatrix to the rescue. Below is a function which will desaturate a passed DisplayObject.
desaturate(clip);
// convert passed clip to greyscale
function desaturate(obj:DisplayObject)
{
var r:Number=0.212671;
var g:Number=0.715160;
var b:Number=0.072169;
var matrix:Array = [r, g, b, 0, 0,
[...]