Actuate Tween on GlowFilter


#1

Hi,
I was trying out making a different type of simple rollover effect, and thought I’d do this by adding a GlowFilter to a Sprite, and then tweening parameters of the glow.
It works, but very inconsistently (maybe on the first rollover, or when you click). My MouseOver/Out events call these functions:

    this._glow = new GlowFilter(0xff0000, .4, 2, 2, 3, 2, false, false);

    ...

    private function fadeUp(e):Void
	{
		trace('over');
		Actuate.tween(this._glow, 0.95, {alpha:1, blurX:9, blurY:9}, true);
	}
	private function fadeDn(e):Void
	{
		trace('out');
		Actuate.tween(this._glow, 0.60, {alpha:0.2, blurX:1, blurY:1}, true);
	}

Is there something else I should be doing? (I’ve got a vague recollection of setting a _dirty property to a sprite to force it to be re-rendered, but I think this wasn’t OpenFL.)


#2

You might need to re-apply the filters to your sprite each frame:

	private function fadeUp(e):Void
	{
		trace('over');
		Actuate.tween(this._glow, 0.95, {alpha:1, blurX:9, blurY:9}, true)
			.onUpdate(function() { sprite.filters = sprite.filters; });
	}
	private function fadeDn(e):Void
	{
		trace('out');
		Actuate.tween(this._glow, 0.60, {alpha:0.2, blurX:1, blurY:1}, true)
			.onUpdate(function() { sprite.filters = sprite.filters; });
	}

#3

Try Actuate.effects (this, 0.95).filter (this._glow, { blurX: 9, blurY: 9 });


#4

Thanks both, I had had some success by also adding a tween to another property of the sprite, but, I think this is better.


#5

From the doc:

You can also tween filters. You can reference the filter by its class, or by the value of its index in the filter array, whichever is easier
Actuate.effects (MySprite, 1).filter (BlurFilter, { blurX: 10, blurY: 10 });