PDA

View Full Version : Change Alpha while applying color thru ActionScript..



neh_g
July 21st, 2003, 04:37 AM
hello,
I am making a game where i want my movieclip with diff color. i am applying color thru..

tintColor = new Color(myMovieClip);
tintColor.setRGB(random(255255255));

this will apply a full color to my movieclip. wht i want to apply a color with opacity(alpha) e.g if random color came to Red then red should apply at myMovieClip with 50% opacity. How can i achive tht? can anybody help me.
thanks
Neh

e.s.x.s
July 21st, 2003, 04:39 AM
myMovieClip._alpha = 50;

e.s.x.s

neh_g
July 21st, 2003, 04:46 AM
thanks..but i dont movieCLip alpha to change.. i want color to apply on movieclip with 50% opacity....

e.s.x.s
July 21st, 2003, 05:20 AM
ok try to use transform color object properties:

myNewColor = new Color(myMovieClip);
myColorTransform = new Object();
myColorTransform.ra = 50;
myColorTransform.rb = 244;
myColorTransform.ga = 40;
myColorTransform.gb = 112;
myColorTransform.ba = 12;
myColorTransform.bb = 90;
//------u can set alpha of color----------
myColorTransform.aa = 40;
myColorTransform.ab = 70;
//----------------------------------------------
myColorTransform.setTransform(myColorTransform);

/*
ra is the percentage for the red component (-100 to 100).

rb is the offset for the red component (-255 to 255).

ga is the percentage for the green component (-100 to 100).

gb is the offset for the green component (-255 to 255).

ba is the percentage for the blue component (-100 to 100).

bb is the offset for the blue component (-255 to 255).

aa is the percentage for alpha (-100 to 100).

ab is the offset for alpha (-255 to 255). */


e.s.x.s

Digitalosophy
July 21st, 2003, 02:27 PM
http://www.kirupaforum.com/forums/showthread.php?threadid=25935&highlight=alpha+actionscript

check out LIB's prototype