We help IT Professionals succeed at work.

Tint Tweener

TheYan asked
I need to tint an image, in my function there is a tweener, like this:


Open in new window

Instead of alpha (50%) I want it to be tint by 50%, how can it be done?
Watch Question

Top Expert 2010

You can control tinting as well as alpha by using the Color object and its setTransform().  


can you modify the code above to work?
Try this (assuming the color of the object was set to "0x000000" initially). It should display all colors available in a 10 second interval ... as color is a simple uint with the highest level bits controlling "red", the mid-level bits controlling "green" and the lowest-level bist controlling "blue". Think this example is relatively unpractical, but it should get you the idea.


Open in new window


The color does not change, nothing happens, if instead of "color" I put "_color" then it will replace the image with that color. Any other ways of making it work?
Top Expert 2009
you're right, Tweener uses the underscore syntax for AS2 and AS3 (very confusing) - have a look at snippet below.
it think you're missing your colorshortcuts.

import caurina.transitions.properties.ColorShortcuts;
import caurina.transitions.Tweener;

bob.addEventListener(MouseEvent.CLICK, doTween);

function doTween(e:MouseEvent):void
      Tweener.addTween(objClip, {_color:0x0FFFFFF, time:10, transition:"regular"});
Geee ... you're right blue-genie ...

the properties without "_" control the tween and the ones with control the target properties. Can I sum it up to that?
Top Expert 2009

Hey Christofer - i was just reading the asker's last post again.

"then it will replace the image with that color. Any other ways of making it work?"
that's what a tint will do to an image. you can't "colorise" it like you would in photoshop.