Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

tween gradual tint change plz help!

Explorer ,
Mar 03, 2011 Mar 03, 2011

Hey,

Im trying to get a movieClip to change its tint on roll over and back to normal on roll out. But this has to happen gradually like a tween.

Im trying to use the code for alpha tween but its not exectly wut i need any ideas?

i also tried the tweenlite but im to confused :S

any help is much appriciated

here is my code:

import fl.transitions.Tween;

import fl.transitions.easing.*;

import fl.motion.easing.Back;

var anim:Animation = new Animation  ;

import fl.motion.Color;

//create a Color object

var c:Color=new Color();

//set the color of the tint and set the multiplier

//apply the tint to the colorTransform property of

//the desired MovieClip/DisplayObject

var alphaVAR:int;

addChild(anim);

anim.x = 250;

anim.y = 200;

anim.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);

anim.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);

function mouse_Over(event:MouseEvent):void

{

var myTweenAlpha:Tween = new Tween(anim,"alpha",Regular.easeOut,0,1,3,true);

}

function mouse_Out(event:MouseEvent):void

{

}

thx pavel

TOPICS
ActionScript
555
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Mar 03, 2011 Mar 03, 2011

In TweenMax (www.greensock.com)

you can find a nice example for this.

Search for the example colorTransform and have a look at the interactive paramaters.

Also use ROLL_OVER/ROLL_OUT instead of MOUSE_OVER/MOUSE_OUT

After you have imported the relevant classes (load them fropm greensock) your code should go like this:

import com.greensock.*;
import com.greensock.easing.*;

....

//make sure anim has no mouseChildren that could get in the way

anim.mouseChildren = false;

anim.addEventListener(MouseEvent.ROLL_OVER, mouse_Over);

anim.addEventListener(MouseEvent.ROLL_OUT, mouse_Out);

function mouse_Over(event:MouseEvent):void

{

//tint it to 50% red in 1 second

TweenMax.to(event.currentTarget, 1, {colorTransform:{tint:0xff0000, tintAmount:0.5}});

 

}

function mouse_Out(event:MouseEvent):void

{

//untint it in 1 second

TweenMax.to(event.currentTarget, 1, {colorTransform:{tint:0xff0000, tintAmount:0}});

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 03, 2011 Mar 03, 2011
LATEST

hey man thx for the reply very helpful...this is kinda where i was stuck, the importing of the tweenlite class.

i downloaded the package with of the classes but i not sure which one to use now

thx pavel

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines