PDA

View Full Version : TextInput Component Background Colour to transparent


jeremydore
10-27-2006, 05:15 PM
Hi,
Have looked through all the posts and my books and can't find a way to get the background of the TextInput component to go transparent.
From what I've read, this should work:
this.myTextInput.invalidate();
this.myTextInput.setStyle("backgroundColor", "transparent");

... the annoying thing is that it doesn't work. If I change "transparent" to 0xFF0000 then I do get a red background as expected.

Is this component incapable of being transparent? I really hope not as I need editable text on top of my other MCs.

Many thanks for any help offered!

Mazoonist
10-28-2006, 12:23 AM
It took a little digging, but I found it for you:

_global.styles.TextInput.setStyle("backgroundColor", undefined);
(This will make ALL of your TextInput components in the file have a transparent background).
The flash help files state:

"You can make the background of TextArea components transparent by setting the backgroundColor style globally to a value of undefined. You then need to set the backgroundColor style to a color individually for all TextArea components that you do not want to be transparent."

Even though they specify TextArea, I tried it with TextInput, and it works great.

Edit: I just gotta add that I think this a really cool effect. I'm glad you asked about it!

jeremydore
10-28-2006, 12:46 PM
Thanks so much for that... yeah, it's a cool effect.

I had tried setting backgroundColor to undefined before, but only on the actual TextInput component instance, not on the _global.styles object. No idea why it only works on the _global one but this does seem to be the case.

Thanks again for the help!