SetTint Of MC In MX.. How ?
I am trying to set the tint of a MC from a level down, on rolling over a button... but it aint working..
I am trying it with this.. the MC instance name is "arrow"
on (rollOver) { _root.arrow.setTint('000000'); }
I have also tried expressing the Hex as '0x000000' as I read somewhere..
any ideas ?? Can/should it be done wit setProperty ? or am I way off ?;0)
Cheers M
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-30-2005, 05:20 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Use SetTint() ?
Hi, if you know how to use the setTint() funciton please, drop me and example code!
What I am trying to do is tint 60% black some thumbnails(Sprites), it does have to be 60% perse, I can use a Black Shape on a Sprite on top of the thumbnails and set the color of the shape to 60% alpha to the black color but I saw setTint I want to use it, or how can I do the same thing using colorTransform, wich I know how to use, but not sure how to tweak the values to get it right.
Thanks for your time!
rS
Fl.motion SetTint Example
I am trying to get the setTint() method of the fl.motion.Color class to work. I couldn't find any examples. Here is what I tried.
import fl.motion.Color;
var ct:Color = new Color();
ct.setTint(0xFF0000,.5);
mc.Color = ct;
Thanks,
Josh
How To Use SetTint() -- How To Change Tint With AS3 -- Informational
I needed help on this but never found anything so I figured it out myself.
Reason I post this is to help anyone else that may need to get this figured out.
Anyway, here it is, how to change tint with a function in AS3:
function tintColor(mc:Sprite, colorNum:Number, alphaSet:Number):void {
var cTint:Color = new Color();
cTint.setTint(colorNum, alphaSet);
mc.transform.colorTransform = cTint;
}
tintColor(sprite1, 0xff0000, .6);
You can also set the mc data type to MovieClip to allow the function to work on movie clips.
If you have any comments and or questions, please feel free to add on to this post.
Generate Random Tintcolor With SetTint?
Using the following AS I can make my_mc´s color change to a random one:
Code:
var colorT:ColorTransform = new ColorTransform();
addEventListener(Event.ENTER_FRAME, chgColor);
function chgColor(e:Event) {
colorT.blueOffset = Math.round(Math.random() * 510) - 255;
colorT.redOffset = Math.round(Math.random() * 510) - 255;
colorT.greenOffset = Math.round(Math.random() * 510) - 255;
my_mc.transform.colorTransform = colorT;
Can I make a function generate a random color tint to my_mc with setTint the same way, or should I do it another way?
How To Stop SetTint From Altering Child Objects?
I haven't been able to figure out a way to change the tint of a display object without effecting all of it's child objects. And once you've changed the tint of the parent, you can't seem to be able to change the tint of a child anymore. As in this code:
import flash.display.DisplayObject;
import flash.display.Sprite;
import fl.motion.Color;
import flash.geom.ColorTransform;
var box:Sprite=new Sprite();
box.graphics.beginFill(0xCCCCCC,1);
box.graphics.drawRect(0,0,200,200);
box.graphics.endFill()
this.addChild(box);
var innerbox:Sprite=new Sprite();
innerbox.graphics.beginFill(0x666666,1);
innerbox.graphics.drawRect(50,50,100,100);
innerbox.graphics.endFill()
box.addChild(innerbox);
var c:Color = new Color();
c.setTint(0xAAAAAA,1);
box.transform.colorTransform = c;
c.setTint(0xFF0000,1);
innerbox.transform.colorTransform = c;
I can't seem to apply a tint to the child once the parent has been tinted. This same problem exists with colorTransform.color as well. Anyone know how to get around this?
|