Skip to main content
December 5, 2011
Question

Change movieClip background

  • December 5, 2011
  • 5 replies
  • 1774 views

this is a movieClip with a textField placed over it. I would like to change the movie clips color when clicked, but not the text color.

var myColorTransform = new ColorTransform();

myColorTransform.color = 0xFFFFFF;

mc.transform.colorTransform = myColorTransform;

When I try the code above it changes the whole movie clip color, text included. Is there a way to just change the background movieclip color and keep the text un changed?

This topic has been closed for replies.

5 replies

Inspiring
December 5, 2011

fix this line, too... you are missing the ()

var indicator:TextField = new TextField();

Inspiring
December 5, 2011

fix this line- you're missing the ()

var header_font = new HeaderFont();

December 5, 2011

I ended up changing the movieClip into a sprite and placed the text field on top. in the event handler I changed the text field color

var s:Sprite = event.target as Sprite;

                              var rbg:TextField = s.getChildAt(0) as TextField;

                              rbg.backgroundColor = 0xFFFFFF;

Ned Murphy
Legend
December 5, 2011

Since you say it is a movieclip with a textfield placed over it, then target the movieclip that makes up the background instead of the parent "mc".  If you didn't mean that the textfield sits atop a movieclip, then change that colored shape into a movieclip symbol and target it for the color trandform.

December 5, 2011

Now I have this problem. Hopefully you can help. When I click on either "tab" some of the tabs loose the mouse cursor and the eventListener. Only the middle two. But it doesnt loose it completly. If you click the very bottom of the clip the listener will activate. I hope the video explains. I dont think I explained it well.

_spoboyle
Inspiring
December 5, 2011

i still can't really tell from the video source code would help.

I did notice the "tabs" had the edit text mouse cursor wheny ou hovered over them.

make sure the textfields have selectable set to false and the parent movieClip has mouseChildren set to false

_spoboyle
Inspiring
December 5, 2011

is there anything else in the movieclip?

have you tried using mc.graphics.beginFill(color), mc.graphics.fill(0, 0, width, height), mc.graphics.enFill()?

if the textfield covers the whole movieclip you could even use textField.background & textField.backgroundColor