ColorTransform Tweening

View the Preview
Download Source - Flash 8

I’ve finally came up with a file where you can input a hexadecimal value into a function and have a ColorTransform object tween itself into that hexadecimal value. I don’t really fancy working with the offsets and multipliers in the ColorTransform object so I wanted to make this easier on myself. Originally, however, you have to set those values in the ColorTransform you set up. What I did was I set it to the first value in the colors array. To do this, I just simply drew a movie clip on stage and adjusted its Tint. Then I went to the Advanced settings to find out what the values are, plugged them into the CT object, and deleted the tester clip off the stage.

I also left a function in there that is not necessary, the argbToHex function, just in case anyone needs it for future reference. Hope this is helpful to some of you because it sure is going to make my life a lot easier.

NOTE: You will need the TweenExtended class from SquareCircle.

2 Responses to “ColorTransform Tweening”

  1. Brad K Says:

    Very nice! not quite sure I understand completly how it works… but am messing w/ it all the same.
    How do you control the speed with which colors transition?
    cheers - Brad K.

  2. Matt Przybylski Says:

    Oh i guess I should have made a speed variable for it, but you can change the .25 in the TweenExtended statement for colTween which is what controls the speed. it’s in seconds so it changes over a fourth of a second currently.

Leave a Reply