TextField, CSS
Today i was working on improving my latest Flash 8 site. My goal was to incorporate a CSS style sheet for all the loaded text on the site.
I quickly ran into some problems.
The data is loaded from xml files. And some of these xml files had the cdata tag to preserve html formatting (f.i. using external links), but others didn't.
To make sure my text got the correct formatting i added a declaration to my css file :
body{ color: #333333; font-family: Tahoma; font-size: 12px; display: inline;}
and added a little piece in my actionscript :
pod_string="<"+"body"+"/>"+pod_string+"<"+"body"+"/>";
Now all not-html formatted text get's it's style from the body-tag. (all the extra plusses is for displaying here)
Then i had to solve another problem.
It seemed to me that i was looking at Flash 7 text... no advanced anti-aliasing.
These lines take care of that :
txt_container.antiAliasType = "advanced"; txt_container.embedFonts = true; txt_container.gridFitType = "subpixel";
where txt_container is a new TextField...
Do this BEFORE assigning the stylesheet to the TextField!
Pretty cool no? Gives me a lot more freedom to externally format my text...
I quickly ran into some problems.
The data is loaded from xml files. And some of these xml files had the cdata tag to preserve html formatting (f.i. using external links), but others didn't.
To make sure my text got the correct formatting i added a declaration to my css file :
body{ color: #333333; font-family: Tahoma; font-size: 12px; display: inline;}
and added a little piece in my actionscript :
pod_string="<"+"body"+"/>"+pod_string+"<"+"body"+"/>";
Now all not-html formatted text get's it's style from the body-tag. (all the extra plusses is for displaying here)
Then i had to solve another problem.
It seemed to me that i was looking at Flash 7 text... no advanced anti-aliasing.
These lines take care of that :
txt_container.antiAliasType = "advanced"; txt_container.embedFonts = true; txt_container.gridFitType = "subpixel";
where txt_container is a new TextField...
Do this BEFORE assigning the stylesheet to the TextField!
Pretty cool no? Gives me a lot more freedom to externally format my text...
0 Comments:
Post a Comment
<< Home