# Attaching stylesheet to multiple text boxes

**URL:** <https://forum.kirupa.com/t/attaching-stylesheet-to-multiple-text-boxes/169014>\
**Category:** flash\
**Created:** [November 12, 2005, 6:55am UTC](https://forum.kirupa.com/t/attaching-stylesheet-to-multiple-text-boxes/169014 "2005-11-12T06:55:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![skylabel](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@skylabel](https://forum.kirupa.com/u/skylabel)\
**Post date:** [November 12, 2005, 6:55am UTC](https://forum.kirupa.com/t/attaching-stylesheet-to-multiple-text-boxes/169014/1 "2005-11-12T06:55:50Z")

</div>

[font=Arial]Hi, I’ve got a flash project with an empty content clip instance called **content\_mc**. Depending on the button pressed, it attaches a movieclip from the library with the name **contentDisplay\_mc** under content\_mc. Now the structure of these subclips are pretty much the same with a textbox called Display. The code on Frame 1 of main timeline:[/font]

[color=darkgreen][font=Courier New]//tell Flash to display special characters[/font]  
[font=Courier New]System.useCodepage=true; [/font]  
[font=Courier New]var cssStyles = new TextField.StyleSheet();[/font]  
[font=Courier New]var generic\_lv = new LoadVars();[/font][/color]  
[color=darkgreen][font=Courier New]cssStyles.onLoad = function() {[/font]  
[font=Courier New]content\_mc.contentDisplay\_mc.display.styleSheet = this;[/font]  
[font=Courier New]content\_mc.contentDisplay\_mc.display.html=true; [/font]  
[font=Courier New]}[/font][/color]  
[font=Courier New] [/font]  
[color=darkgreen][font=Courier New]generic\_lv.onLoad = function (success){ [/font]  
[font=Courier New]if (success == true) { [/font]  
[font=Courier New]content\_mc.contentDisplay\_mc.display.htmlText = generic\_lv.textvar; [/font][/color][color=darkgreen]  
[font=Courier New]}[/font]  
[font=Courier New]} [/font][/color]  
[color=darkgreen][font=Courier New]function loadmc(id) {[/font]  
[font=Courier New]content\_mc.attachMovie(id, “contentDisplay\_mc”, getNextHighestDepth());[/font]  
[font=Courier New]cssStyles.load(“cssStyles.css”);[/font]  
[font=Courier New]}[/font][/color]  
[font=Courier New][/font][color=darkgreen]  
[font=Courier New][color=navy]//initial mc to attach[/color][/font]  
[font=Courier New]loadmc(“content0”);[/font]  
[font=Courier New] [/font]  
[font=Courier New][color=navy]//define action for buttons[/color][/font][/color]  
[color=darkgreen][font=Courier New]menu\_mc.btn0.onRelease = function() {[/font]  
[font=Courier New]loadmc(“content0”);[/font]  
[font=Courier New]}[/font]  
[font=Courier New]menu\_mc.btn1.onRelease = function() {[/font]  
[font=Courier New]loadmc(“content1”);[/font]  
[font=Courier New]}[/font][/color]  
[font=Courier New][color=darkgreen]  
[font=Arial][color=black]Now the movieclips and associated text files are loading alright, but somehow the stylesheet isn’t being applied to content1, although it is to content0. [/color][/font]

[font=Arial][color=black]The code in content0[/color][/font]  
[font=Arial][color=black][font=Courier New]\_root.generic\_lv.load(“content.txt”);[/font] [/color][/font]

[font=Arial][color=black]The code in content1[/color][/font]  
[font=Courier New][color=black]\_root.generic\_lv.load(“content1.txt”);[/color][/font]

[font=Arial]Can anyone help me out?[/font][/color][/font]
