Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to change color of a mc using actionscript

Guest
Jun 11, 2009 Jun 11, 2009

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?

TOPICS
ActionScript
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 12, 2009 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 14, 2009 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 15, 2009 Jun 15, 2009
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 13, 2009 Jun 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});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 14, 2009 Jun 14, 2009

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

later version of Flash?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2009 Jun 14, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines