Thank you for the replies.
My issue was due to the fact that I was overlooking the "rgb"
property (doh), and inadvertently tweening it along with the other
properties. Below is the functional code which uses MultiTween and
mx.transitions.Tween to tween a few ColorTransform objects.
-Danro
FLA Example:
http://download.danro.net/flashcoders/ColorTrans_Tween.zip
Code:
import com.gskinner.transitions.MultiTween;
import flash.geom.Transform;
import flash.geom.ColorTransform;
import mx.transitions.easing.*;
import mx.transitions.Tween;
import mx.utils.Delegate;
// color transform objects
var originColor:ColorTransform = new ColorTransform();
var currentColor:ColorTransform = new ColorTransform();
var rollOverColor:ColorTransform = new ColorTransform();
var rollOutColor:ColorTransform = new ColorTransform();
rollOverColor.rgb = 0xFFCC00;
rollOutColor.rgb = 0x0066CC;
// movieclip transform
var trans:Transform = new Transform(test_mc);
// update color function
function updateColor () { trans.colorTransform = currentColor; }
// tween vars
var colorTween:Tween;
var mTween:MultiTween;
var mTweenProps = ["alphaMultiplier", "alphaOffset",
"blueMultiplier", "blueOffset", "greenMultiplier", "greenOffset",
"redMultiplier", "redOffset"];
// rollover tween
function buttonRollOver () {
mTween = new MultiTween(currentColor, rollOverColor, mTweenProps);
colorTween.stop();
colorTween = new Tween(mTween, "position", Regular.easeOut, 0, 1, 20);
colorTween.onMotionChanged = Delegate.create(this, updateColor);
}
// rollout tween
function buttonRollOut () {
mTween = new MultiTween(currentColor, rollOutColor, mTweenProps);
colorTween.stop();
colorTween = new Tween(mTween, "position", Regular.easeInOut, 0, 1,
20);
colorTween.onMotionChanged = Delegate.create(this, updateColor);
colorTween.onMotionFinished = Delegate.create(this, reset);
}
// reset color to original
function reset () {
mTween = new MultiTween(currentColor, originColor, mTweenProps);
colorTween.stop();
colorTween = new Tween(mTween, "position", Regular.easeInOut, 0, 1,
30);
colorTween.onMotionChanged = Delegate.create(this, updateColor);
}
// button events
test_mc.onRollOut = Delegate.create(this, buttonRollOut);
test_mc.onRollOver = Delegate.create(this, buttonRollOver);
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com