Is there an actionscript to change the color of a mc on the stage? it is going to play on release, but I want to button to look actionable when you roll over it.
thanks!
Printable View
Is there an actionscript to change the color of a mc on the stage? it is going to play on release, but I want to button to look actionable when you roll over it.
thanks!
import flash.geom.Transform;
import flash.geom.ColorTransform;
//to get the color settings, apply the desired tint to the mc via
//the properties/color/tint settings
//then go to properties/color/advanced and click on the setting tabs
//the numbers you see are what you put in the Color Transform object
//50% = .5 etc.
var yellow_tint = new ColorTransform(.5, .5, .5, 1, 128, 128, 0, 0);
var reset_color = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
//mc_name is the name of your mc
trans=new Transform(mc_name);
mc_name.onRollOver=function(){
trans.colorTransform=yellow_tint;
}
mc_name.onRollOut=function(){
trans.colorTransform=reset_color;
}
Thank you sooooo much!
so yours worked- is there a reason it doesn't work when I change the values to
(0, 0, 0, 1, 156, 180, 192, 0) ?
I want a bluish grey hue.
Your first three numbers are the percent of the tint, by having them set to 0, the tint is set to 0.
heres's an example:
var bluegray_tint = new ColorTransform(.5, .5, .5, 1, 39, 50, 68, 0);
Thanks- I have one more problem- I have a list of movie clips that I want to do the same thing. When I add the script to the keyframe of the second mc, it disables them. Why?
How can I apply this effect to a number of mcs on the same page?
Thanks so much!
import flash.geom.Transform;
import flash.geom.ColorTransform;
//to get the color settings, apply the desired tint to the mc via
//the properties/color/tint settings
//then go to properties/color/advanced and click on the setting tabs
//the numbers you see are what you put in the Color Transform object
//50% = .5 etc.
var yellow_tint = new ColorTransform(.5, .5, .5, 1, 128, 128, 0, 0);
var reset_color = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
//mc_name is the name of your mc
mc1.onRollOver = function() {
trans = new Transform(this);
trans.colorTransform = yellow_tint;
};
mc1.onRollOut = function() {
trans.colorTransform = reset_color;
};
mc2.onRollOver = function() {
trans = new Transform(this);
trans.colorTransform = yellow_tint;
};
mc2.onRollOut = function() {
trans.colorTransform = reset_color;
};
where do I put that code? In the keyframe with the first mc? In each of the mcs' keyframes? In a frame on the main timeline? Sorry! I just can't get it to work!!
on the first frame of the main timeline. Give each of the mcs on the stage an instance name. In my exampl I used mc1 and mc2 as the instance names.
I have no idea why I cannot make this work. :-(
When I just do the code for the 1st mc it works fine. Then when I add more, none of it works. Does it matter that they are all on different layers and show up in the movie at different times?
Oh well. Thanks!
The mcs need to be on the stage when the onRelease events are declared. So if the code is on frame 1, the mcs need to also be present on frame 1.
Rock and Roll! You rule. Thank you!
is there something to disable this on release? Otherwise the movies are showing with that color tint.
Thanks!!!
-Lyn
mc2.onRelease = function() {
trans.colorTransform = reset_color;
};
mc2.onReleaseOutside = function() {
trans.colorTransform = reset_color;
};