PDA

View Full Version : Changing TINT of Movie Clip dynamically


cbass
07-23-2002, 01:24 PM
I have a rectangle filled with grey in my library stored as a movie clip.

If i drag an instance onto the stage, I can change properties including TINT = making the color someting different.

The problem I am having is that I can't figure out how to do this dynamically through actionscript. What I am looking for is something like:

myInstance._tint = red << this does not exist :)

Any help would be appreciated!

Charlie

matt poole
07-23-2002, 02:14 PM
Im not exacly clued up in this but you could try browsing through the library. do a search for 'rgb'. There are several scripts on altering rgb values with action script. You may be able to find something in here.

the setRGB command looks like iot might be usful.

tg
07-23-2002, 03:37 PM
look thru some of these:
http://www.actionscripts.org/forums/search.php3?s=&action=showresults&searchid=87262&sortby=lastpost&sortorder=descending
and some of these:
http://www.actionscripts.org/forums/search.php3?s=&action=showresults&searchid=87698&sortby=lastpost&sortorder=descending

Chortle
09-10-2004, 05:09 PM
Macromedia tutorial at:

http://www.macromedia.com/support/flash/interactivity/colorobject/colorobject04.html

Cota
09-10-2004, 05:51 PM
Any my personal favorite:
http://proto.layer51.com/l.aspx?p=10

anakha
04-23-2005, 07:21 PM
there is a prototype from
http://proto.layer51.com/l.aspx?p=10
which is very useful and exactly like this

//tint an object with a color just like Effect panel
//r, g, b between 0 and 255; amount between 0 and 100
Color.prototype.setTint = function (r, g, b, amount) {
var percent = 100 - amount;
var trans = new Object();
trans.ra = trans.ga = trans.ba = percent;
var ratio = amount / 100;
trans.rb = r * ratio;
trans.gb = g * ratio;
trans.bb = b * ratio;
this.setTransform(trans);
}//Robert Penner June 2001 - www.robertpenner.com