Actuate Tween on GlowFilter

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

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

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

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

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

Is there a way to use it with a starling DisplayObject ?
( like in ‘Actuate.tween’ method )

I think you can use actuate.tween with everything.

1 Like

Yes you are right, with Actuate.tween I can use both starling\non starling displayObject

but i nned to use ‘Actuate.effects’
and it seems that it’s only takes flash displayObject

I don’t remember the code behind effect but I think it’s because when you change a variable in a filter, you have to reassign the said filter to the filter property of the display object, so I think that effect do that.

You could make your own Actuator. Just look at the FilterActuator and try to adapt it to Starling if you want. But like I said, FilterActuator exists only because of the needed reassignement. Is it needed in Starling? There must be other options like using simple tween or even update