Adding Filters/effect on MovieClip through ActionScript


Today I need to work to enhance the interface of a Quiz I was trying to build. Suddenly I got an idea to GLOW out the TEXTField and Radio button that need to be fill by user before they move ahead with quiz. I really hate Actionscript because of its inconsistency, but I really love its one (of few) line magic it always does.

var myGlowFilter = new flash.filters.GlowFilter();  //Make a Instanace of a Filter that we need to apply
var myFilters:Array = QuizPlaceHolder.AnswerPanel.filters; //Copy existing Filters on this MovieClip
myFilters.push(myGlowFilter); //Insert new Filter to list of Filters
QuizPlaceHolder.AnswerPanel.filters = myFilters; //Apply new filters back to MovieClip

Hope you find it useful to make your ActionScript stand against designer’s Flash. Please note that I test this code using CS 3 with AS 2.0 but I believe it should work with AS 3.0 as well.