Javascript – How to get colors to work in sIFR 3 r436

cssflashjavascriptsifr

I've got a demo page up here; you can view source to see what I'm trying to do.

As you can see, everything about it seems to be working except for colors. I'm trying to set the color to blue (#0000ff), but it stays as black. I created a custom SWF file for my font, embedding four different variations of a single font in order to accommodate for different styles per these instructions (because this particular font family stores regular, bold, italic, and bold italic as four disjoint font names).

For posterity I'll paste some of the source code from that demo page I linked to here:

<style type="text/css">
h1.sifr {
    color: #0000ff;
    font-family: 'Myriad Pro';
    font-size: 1.75em;
    margin-bottom: 0;
}
</style>
<script type="text/javascript">
var myriad_pro = {src: 'myriad_pro.swf'};
sIFR.activate(myriad_pro);
sIFR.replace(myriad_pro, {
    selector: 'h1.sifr',
    css: {
        '.sIFR-root': {'color': '#0000ff', 'font-family' : 'Myriad Pro'},
        'em': {'color': '#0000ff', 'font-family' : 'Myriad Pro Italic' , 'font-style' : 'plain'},
        'strong': {'color': '#0000ff', 'font-family' : 'Myriad Pro Bold' , 'font-weight' : 'normal'},
        'em strong, strong em': {'color': '#0000ff', 'font-family' : 'Myriad Pro Bold Italic' , 'font-style' : 'plain', 'font-weight' : 'normal'}}
    }
);
</script>

What did I forget? How do I get colors working?

Best Answer

I got it working here. The only difference is that my sifr text is inclosed in links, and it changes color on mouse hover.

My script looks like this:

 <script language="javascript" type="text/javascript">
        //sIFR.useStyleCheck = true;
        var eurostile = {
            src: '/images/eurostile.swf'};
        sIFR.activate(eurostile);
        sIFR.replace(eurostile , {selector: "div#mainNav li", wmode: "transparent", 
        css: [
             'a { text-decoration: none; color: #666666; }'
            ,'a:link { color: #666666; }'
            ,'a:hover { color: #00299b; }'
        ]});
        sIFR.replace(eurostile , {selector: "div.menuHeadingText", wmode: "transparent"
        ,css: [
            '.sIFR-root { color: #FFFFFF; }',
            'a { text-decoration: none; color: #FFFFFF; }'
            ,'a:link { color: #FFFFFF; }'
            ,'a:hover { color: #FF5A00; }'
        ]});

        sIFR.replace(eurostile , {selector: "h2.boxHeading", wmode: "transparent"
        ,css: [
            '.sIFR-root { color: #666666; }'
        ]});

Hope it helps.

/Klaus