tinting a MC with tweener

3.2k views Asked by At

I would like to tint a movieclip with the tweener class.

This is how I tint the mc without the tween:

var c:Color=new Color();

c.setTint(0xff0000, 0.8); clouds.transform.colorTransform=c;

it works but I would like to give it a smooth transition that's why I would use tweener.

Anyone have an idea?

2

There are 2 answers

1
daihovey On BEST ANSWER

Ive found Tweener to not work properly with colour tweens in AS3. I use TweenLite http://blog.greensock.com/tweenlite/:

import com.greensock.*;
import com.greensock.plugins.*;
TweenPlugin.activate([TintPlugin]);
TweenLite.to(mc, 0.8, {tint:0xff0000});
2
heavilyinvolved On

Tweener has a bunch of special properties you can tween (one of them being color). See the documentation here: http://hosted.zeh.com.br/tweener/docs/en-us/

You'll need to import/initialize the class before you can use it like so:

import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();

then you'll want to use the _color property like so:

Tweener.addTween(myDisplayObject, {_color: 0xff0000, alpha: 0.8, time: 2});