Archive for the ‘Flash’ Category

Tinting/Colorizing a MovieClip in AS3

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);

Ignoring xml tag case in AS3 (E4X)

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

DeMonster Debugger for debugging flash

Came across a great Flash debugging tool. Step through your code at runtime and change/monitor properties. Run and catch method results instantly!

JSFL Round coords

I used to use a flash JSFL command for rounding the x and y coordinates of objects on the stage. I had trouble finding it for download so I made one. Get it here.
Drop it in your commands folder:
(Win) Documents and Settings\username\Local Settings\Application Data\Adobe\Flash CS4\en\Configuration\Commands\
(Mac) username/Library/Application Support/Adobe/Flash CS4/en/Configuration/Commands.
Select the objects on the stage you would [...]

Seo and flash? Looks like adobe (and google) were serious about it.

Google, seo, and flash – oh my.

Gaia site.xml creator

A nifty AIR app for creating, printing, and editing a GAIA framework site.xml file.
Originally posted/get it here

Desaturate/greyscale a movieclip in As3

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,
[...]

Get around Flash security sandbox

http://nocrossdomain.com/
A site to get around the secrurity sandbox model of flash. Want to load content from wherever you want? Try this (as long as they are around).