TextField with CSS- setStyle and then reload

[LEFT]Hi,

I have a dynamic textbox, “txtMain”, it loads in html text and then I apply a CSS to it. All works great. Now what I want to be able to do is simply change the font-size at a click on a button i.e. make the text bigger. Here’s my code so far:

var format = new TextField.StyleSheet();
var path = "main.css";
format.load(path);
txtMain.styleSheet = format;
txtMain.text = htmlText;

then on the button handler:

on(release) {
format.setStyle("imagecaption", {fontsize:'30px'});
txtMain.styleSheet = format;
}

My stylesheet:

 p 
 {
    font-family: Arial, Helvetica, Verdana;
    
 }
  .imagecaption {
    font-size: 24px;
    font-weight: bold;
  }
  .normal {
    font-size: 40px;
  }

My HTML:

<p class="normal">This is normal</p><p class="imagecaption">This is image caption</p>

It doesn’t seem to work, can anyone help?

Thanks,

Lilalfyalien
[/LEFT]