Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing fill color of MovieClip Actionscript 3

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;

}
like image 997
Dungeo Avatar asked Apr 28 '09 07:04

Dungeo


1 Answers

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.

like image 80
James Hay Avatar answered Sep 23 '22 14:09

James Hay