Jump to content



Recommended Posts

Ok I have an idea for a game that is similar to the old lights-out game. I have done it before in Java and even on Android. But I want to do it in flash now.


My delema is I want to use images for the buttons, each is a different color. I am looking for a way to dynamically change button colors. So when you press/click a button it will work through a set list of colors. I am trying to find the lite-st way to accomplish this. Maybe a multi-layer button, where I could tween a color layer, if that could even be done.


If I could animation going I can handle the rest. Any help would be appreciated. :)




Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.


Sure, you can tween the tint of a child element of a MovieClip using TweenLite and and the TintPlugin.


Here is a very basic implementation:



import com.greensock.*;
import com.greensock.plugins.*;
import flash.events.MouseEvent;

//create a single tween that can be played and reversed
//the target is a clip called bg inside mc
var mcTween:TweenLite = TweenLite.to(mc.bg, 1, {tint:0xff0000, paused:true});

mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);

function overHandler(e:MouseEvent):void{

function outHandler(e:MouseEvent):void{


For more advanced color control see ColorTransform and ColorMatrixFilter in the Plugin Explorer available in the downloads and here: http://www.greensock.com/tweenlite


I have attached a CS5 fla if you want to see how the MovieClip was created and how it works.

I am using a vector shape, but you could certainly use a bitmap.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.