Skip to main content
Inspiring
June 19, 2007
Answered

how to twean position and color

  • June 19, 2007
  • 7 replies
  • 777 views
Hey - so I think this should be easy, but for some reason I'm finding it tricky.

I have a piece of text on the stage, and I want it to do two kinds of tweans at once - I want it to move about 30 pixels to the right, and I want it to slowly change to a new color. I can animate this easily on the timeline if I do only one of the tweans...

Is there a way to twean and ease with actionscript?
This topic has been closed for replies.
Correct answer kglad
the function below will tween a movieclip mc from startCol to endCol in time seconds. (make sure you've imported mx.transitions.Tween):

7 replies

DZ-015Author
Inspiring
June 19, 2007
yea - but shouldn't I still be able to tween in a color overlay or something?
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 20, 2007
the function below will tween a movieclip mc from startCol to endCol in time seconds. (make sure you've imported mx.transitions.Tween):

Damon Edwards
Inspiring
June 19, 2007
true means in seconds, false means in frames.. the problem is, the target is the movie clip, not the shape you want to transform
Damon Edwards
Inspiring
June 19, 2007
yea, no that doesnt work... i dont see how you can be using the Tween class if you can only reference a Movie Clip as the object.. but good luck!
Damon Edwards
Inspiring
June 19, 2007
i could be way off, but maybe redOffset, blueOffset, greenOffset would be the properties... i could very well be wrong though.. but it doesnt hurt to try
EX:
var tw:Tween = new Tween(your_mc, "redOffset", mx.transitions.easing.Strong.easeOut, 10, 40, 1, true);

DZ-015Author
Inspiring
June 19, 2007
hum.... no dice.

I tried tweaking it to:
new Tween(mcThing, "redOffset", mx.transitions.easing.Strong.easeOut, 10, 100, 60, false);

...and still no dice...
kglad
Community Expert
Community Expert
June 19, 2007
p.s. you can tween to a hex value. but the intermediate colors won't look the way you expect unless you independently control the r,g and b components.
DZ-015Author
Inspiring
June 19, 2007
haha - last question, I promise!

I've applied colors with actionscript before, but it was back with the old AS1 paradigm... how do I reference the color values, the R G and B values within a color?

Thanks again - you've been a huge help!
kglad
Community Expert
Community Expert
June 19, 2007
control the red, green and blue components independently with their own tweens.
Inspiring
June 19, 2007
Have a look at the Tween class in the Help...
DZ-015Author
Inspiring
June 19, 2007
Ok - yea. The Tween class looks promising... but I can't see how I can use it to change the color of an object...

I can only enter a single number as the "end" of the tween - how can I use this to change the hex value of a text field?

...maybe i'm just approaching this from the wrong direction and I should nest the text field inside another movie clip... move the container, and tween the color of the text within the container. But i'd have to do that at authoring time, and that seems kind of limiting...

any suggestions?