Skip to main content
June 12, 2009
Question

how to change color of a mc using actionscript

  • June 12, 2009
  • 2 replies
  • 2278 views

The attached Ai file contains several parts (states) each of which needs to be imported to Flash as an individual movie clip; and then be able to color each of the states individually.  At some later stage actionscript 3 needs to change each state's color. How to achieve each of these steps?

This topic has been closed for replies.

2 replies

June 13, 2009

I would suggest TweenLite, it makes it real easy to color clips. This will color the mc clip cyan in one second:

TweenLite.to(mc, 1, {tint:0x3399ff});

June 14, 2009

Don't seem to have TweenLite in my Flash CS3 Professional system. Is it in a

later version of Flash?

kglad
Community Expert
Community Expert
June 14, 2009

it's a public class made by greensock:  http://blog.greensock.com/tweenliteas3/

Inspiring
June 12, 2009

Each movieclip has a colorTransform property that you can change using the properties and methods of the ColorTransform class.

myClip.transform.colorTransform=new ColorTransform(1,1,1,1,255,0,0,0);

That will make myClip red. There are a lot of ways to use it.

June 14, 2009

Thanks for your reply.

I tried your suggestion (see file attached to this email) with no success,

ie it changes the fill to a very pale pink and the boundary (stroke) to red.

What I really want to do is be able to change the color of the fill quite

independently of the color of the boundary. For example in the attached how

can I just change the color of the fill whilst leaving the boundary black?

And how can I change the color of the boundary while leaving the fill color

the same?

I have tried various filters but all I want is to just keep that boundary

constant except for changing the color.

I don't have any problem in setting up say a rectangle as a graphic and

changing the fill and the stroke independently. This approach doesn’t work

for the attached file where the display object was imported from Ai and

converted to a movie clip.

June 15, 2009

If the fill is a pale color, it suggests you have the alpha less than 100%. As for changing the fill vs the border - you can see how TweenLite takes a movieClip as it's first parameter... you will need to split out the border and fill into separate clips.