i want to ask, how to change only fill color of an instance on the stage - i can do it by using ColorTransform object, but it changes color of the whole instance, not just the fill. I want to change only the fill color, not the stroke color. can anybody help me?
this is my code:
function paint(){
var myColorTransform:ColorTransform = new ColorTransform();
myColorTransform.color = someColorNumber;
coloredObject.transform.colorTransform = myColorTransform;
}
This cant be done once you've drawn a shape as action script has no way of determining what is a stroke and what is a fill.
You have a couple of options.
Separate your fill and stroke into separate movie clips and set the color transform to only apply to the fill.
or
If it's a simple shape, draw it using the Graphics object where you can specify fill colours and stroke colours.
Likely hood is, and my preferred method, would be the first options as the shape is likely to be complex and leaving it in the fla gives greater control for a designer being able to change it rather than a developer. It's a little more work though and slightly more complex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With