I've seen a fair few posts asking how to make the background of the TextArea component transparent. Some people have been suggesting the hack:
this.myTextAreaInstance.depthChild0._alpha=0;This will make both the border and background invisible but will not affect the scrollbar. There is a better way...
After reading the actionscript docs relating to this I can understand the confusion.
Given my limited knowledge of OOP I've tried to make some sense of it all.
Normally we can set component styles using a property of the _global object (_global.style). If you change a property's value on the
_global style declaration, the change is applied to all components in your Flash document.
The "style" property of _global is an instance of the CSSStyleDeclaration class.
Components, such as TextArea and TextInput have their backgroundColor and borderStyle properties predefined with
class style declarations"
Because the class style declaration takes precedence over the _global style declaration when determining style values, setting backgroundColor on the _global style declaration would have no effect on TextArea and TextInput."
So, we can see that the following code should (and does) work on a scrollpane but not a TextArea component
_global.style.setStyle("backgroundColor", "0xFF00FF");If the class style declaration takes precedence over the global style declaration then what we need to do is set a class style declaration for our class of component. The syntax is probably the most confusing thing here. Note that we are using
_global.styles (not _global.style) :
_global.styles.TextArea.setStyle("backgroundColor", "false");Above we are using the setStyle method of the TextArea class, which takes precedence over _global.setStyle. You can also do this:
_global.styles.TextArea.backgroundColor = undefined;
ARCHIVES

nwebb.co.uk - flash tutorials, php and more.