In ActionScript 3 the TextArea object CSS attribute can be fussy

You can get different results from the same SWF if it’s executed locally versus a web server.

Suppose you have a TextArea object called “mytext” and you want this object to use css.

code 1

mytext.styleSheet = css;
addChild(mytext);

code 2

addChild(mytext);
mytext.styleSheet = css;

code 1 will render the TextArea object just fine on the local system but will not correctly render the css (specifically the line-height) from a web server.

code 2, however, will render the css correctly in both cases.


Posted: April 30th, 2009 | Author: | Filed under: Code Reference | Tags: | No Comments »