简体   繁体   中英

After transform.colortransform on mc, can't change textfield's color within mc

I'm trying to change the color of a textfield that is inside of a movie clip, in a game. I change the color of the movie clip using this:

var newColor:ColorTransform = new ColorTransform();//color change

newColor.color = 0x000000;

circle.transform.colorTransform = newColor;

This works fine. However, I have added a textfield to circle, using this.addChild(), called A (public var A:TextField = new TextField(), which I have set to have a white color). When I try to change the color of the text of A, using A.textColor = 0xFFFFFF, after using transform.colortransform, the color of the circle is still black and A becomes black too. No matter how often I call to change A's text color, it stays black.

Any one have any idea about what could be going wrong?

Thanks, FF

ColorTransforms are applied to all contents (and children) of a MovieClip. It doesn't matter what color the TextField (or any other DisplayObject child) is, it will all render black. Your options are:

  • Apply the black colorTransform not to the parent MovieClip, but to the circle you want to turn black.

  • Move the TextField out of the parent MovieClip

This is the same as geometric transforms - if you rotate the parent movieclip, the children inside are all rotated accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM