Multiple styles in Textfield

  • I have a textfield which displays text appropriate to the current scene, e.g.

    <plugin name="description"
    url="%SWFPATH%/plugins/textfield.swf"
    .....
    html=""
    css="p{color:#000000; font-family:verdana; font-style:regular; font-size:14px; text-align:justify; }"
    .....
    />

    followed by, e.g.

    <action name="updateinfo">
    txtadd(plugin[description].html,[p],get(scene[get(xml.scene)].title),[br],get(scene[get(xml.scene)].info),[/p]);
    </action>

    This works fine, but I would like the first piece of text (before the [br]) to be in a different colour to the rest. I'm not at all familiar with css, and I have tried various ways. The best I can achieve is by inserting an inline css font colour instruction in the txtadd.. statement. That works in HTML5, but not in Flash.

    Is there any way to declare multiple styles within the css field in the plugin declaration, and would that work in both HTML5 and in Flash, please?

    Regards

    Andrew

  • Thanks for that, Umalo. I have just tried it, but cannot get it to work (although that may be due to my lack of skills in XML!)

    I tried instead set(plugin[description].css,"p{color: #FF0000 etc., and that does change the font colour, but a subsequent call to txtadd then replaces all my previous text rather than adding to it.

    At the moment I'm stuck with inserting this -

    <span style="color: #FF0000"> and </span>

    around words to be in red in my txtadd(... statement. This indeed works in HTML5, but not in Flash.

    On the subject of Flash, at the moment in my outer .html file I am changing html5:"prefer" to html5:"auto" so that Flash is used where available. Am I wrong to do this? Are there any advantages? Or should I let HTML5 be the technology of preference, now that Flash seems to be on the decline, particularly with the massive rise in popularity of mobile devices sold that don't have Flash anyway?

    Regards

    Andrew

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!