Posts Tagged ‘help’

Converting an image to black & white using AS3

Wednesday, January 27th, 2010

Last week I found myself needing to convert a colour image to black and white and here’s how I did it!

import flash.filters.ColorMatrixFilter;
import fl.motion.AdjustColor;
//==========================
var color : AdjustColor;
var colorMatrix : ColorMatrixFilter;
var matrix : Array;
var filterBW : Array;
color = new AdjustColor();
color.brightness = 20;
color.contrast = 20;
color.hue = 0;
color.saturation = -100;
matrix = color.CalculateFinalFlatArray();
colorMatrix = new ColorMatrixFilter(matrix);
filterBW = [colorMatrix];

Now we can set the .filters property of our image to be filterBW, and shazam you have a black and white image.

AS3 Music Visualiser using computeSpectrum() and FLiNT

Tuesday, December 22nd, 2009

Op Art

I have been thinking about building a visualiser since 2003 (when I saw one on www.2advanced.com) and have finally found the time to look into AS3′s computeSpectrum as well as Richard Lords’ FLiNT Particle System and came up with this example which uses Jamie T’s – The Man’s Machine (which you can buy here).

(more…)

Clear AS3 BitmapData

Tuesday, September 29th, 2009

geek

You’d think that there would be a way to clear BitmapData maybe something like BitmapData.clear(), but when is anything that simple. So far the best I’ve come up with is…

(more…)

Focus Flash in the Browser

Thursday, July 16th, 2009

geek

When flash is embeded within a HTML page it doesn’t by default have focus, this means it won’t capture things such as keyboard interaction. However there is a very simple fix using swfObject to embed your flash movie and a simple bit of Javascript.

Add this javascript function to your header..

(more…)

Flash in Fullscreen Spacebar bug

Wednesday, June 17th, 2009

geek

Why is it when just when you think a project is almost there some kind of nasty bug rears its ugly head, thats what happenned to me today when I uploaded my swf to the test server for the first time and tested it in the browser.

(more…)

Image caching bug in Firefox and Safari

Wednesday, June 10th, 2009

geek

Last week I ran into some trouble when trying to load images dynamically in flash, 99% of the time my images loaded in as they should but at what seemed like random intervals and image would suddenly fail to appear, this was only happening in Firefox or Safari, IE has never as far as I can tell failed to load an image when I’ve been using it to test this project. At first I thought it might be a problem with the platform the site was running on however after some testing I was able to rule this out so I turned back to my trusty friend Charles the Web Debugging Proxy for some help.

(more…)

Fonts Disapear in Loaded SWF

Sunday, May 17th, 2009

geek

Always remeber to register your fonts in externally loaded SWFs is the lesson learned today, afterI loaded my project SWF into my preloader SWF and found none of my embeded fonts were appearing!!

(more…)

Crossdomains, Sandboxes, and Proxies

Friday, May 8th, 2009

Recently I came across the problem of trying to manipulate the bitmap data of an image loaded from a server which doesn’t host a crossdomain.xml ot where it doesn’t allow all domains. I tried a couple of different things to try and get round this problem most notably Martin Legris’ fix (Getting around the crossdomain.xml file when loading images in as3) but annoyingly nothing I tried would work.

(more…)

Check Class/Object Type with getQualifiedClassName

Saturday, August 9th, 2008

Help Me Techy Geek Boy

Recently I found that I needed to type check and object in actionscript 3 and didn’t have the first clue how to do it. As always google was my friend and here’s the solution I came up with.

import flash.utils.getQualifiedClassName;
//=============================
public static function checkClassType(obj:*):String
{
	var nam:String = getQualifiedClassName(obj);
	return nam;
}
//=============================