MC Tweener Add Glow Filter

If you are using the latest SVN version of Tweener (AS3), you can get the GlowFilter with Tweener to work. Here’s the code sample assuming you have a movie clip named “box” on the stage.

Most important thing here is to make sure that you initiate the shortcut:
FilterShortcuts.init();

// Import Filters
import flash.filters.*;
// Import Tweener
import caurina.transitions.Tweener;
// Import Tweener propertie shortcuts
import caurina.transitions.properties.FilterShortcuts;
// *** Very Importaint *** : Initialize shortcuts
FilterShortcuts.init();

var glowIn:GlowFilter = new GlowFilter(0x9A1A06,0.8,10,10,2,2);
var glowOut:GlowFilter = new GlowFilter(0x9A1A06,0,10,10,2,2);

box.addEventListener (MouseEvent.MOUSE_OVER, onOver);
box.addEventListener (MouseEvent.MOUSE_OUT, onOut);

function onOver (m:MouseEvent):void {
	Tweener.addTween (m.currentTarget, {_filter:glowIn, time:1});
}

function onOut (m:MouseEvent):void {
	Tweener.addTween (m.currentTarget, {_filter:glowOut, time:1});
}

2 thoughts on “MC Tweener Add Glow Filter

  1. class, well cool, tell me something, ive been applying tweens to the filters themselves specifically the hex color values and although it works, i.e I can have a colorfilter change color over time it does it in a really random fashion, is there a tweening class that does it just between the two shades specified?

Leave a Reply

Your email address will not be published. Required fields are marked *