Jim,

Here's a utility Class I made to tint any MovieClip using the ColorTransform
object.

Use it and modify it as you wish :)

HTH !

A


class ca.daroost.utils.Tint {
        //
        
/***************************************************************************
******
        *
        *      Constructor : Tint
        *
        
****************************************************************************
*****/
        //
        function Tint() {
        }
        //
        
/***************************************************************************
******
        *
        *      Method : tintMC
        *               
        *      Changes the tint of the targetMC
        *
        *               @param : targetMC - the MovieClip to apply the tint
to
        *                                color - the new color to be applied
        *                                alpha - the new alpha to be applied
        *
        
****************************************************************************
*****/
        //
        public static function tintMC(targetMC:MovieClip, color:Number,
alpha:Number) {
                alpha = (alpha == undefined) ? 100 : alpha;
                var tintTransform:Object = new Object();
                var newColor:Color = new Color(targetMC);
                var r = color >> 16 & 0xff;
                var g = color >> 8 & 0xFF;
                var b = color & 0xFF;
                var pRed:Number = Math.round(r/255*100);
                var pGreen:Number = Math.round(g/255*100);
                var pBlue:Number = Math.round(b/255*100);
                tintTransform.ra = pRed;
                tintTransform.ga = pGreen;
                tintTransform.ba = pBlue;
                tintTransform.aa = alpha;
                tintTransform.rb = 0;
                tintTransform.gb = 0;
                tintTransform.bb = 0;
                tintTransform.ab = 0;
                newColor.setTransform(tintTransform);
        }
}


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 7 novembre 2006 15:59
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Q;Convert hex values to ra,rb,ga,gb,ba,bb,aa,ab??

Hi
Woking on a color selctor and I need to dynamically convert loaded hex
values to values the ColorTransform class uses (ra,ra,ga,gb,ba,gb,aa,ab)

Does anyone know the forumula to do this?

Mucho gracias para tu ayuda!
Jim Bachalo


[e] jbach at bitstream.ca
[c] 416.668.0034
[w] www.bitstream.ca
--------------------------------------------
"...all improvisation is life in search of a style."
             - Bruce Mau,'LifeStyle'
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.31/522 - Release Date: 2006-11-07
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.31/522 - Release Date: 2006-11-07
 

_______________________________________________
Flashcoders@chattyfig.figleaf.com
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

Reply via email to