Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Flash XML / CSS Issue - StyleSheet not applying

Options
  • 14-07-2004 10:46am
    #1
    Registered Users Posts: 2,158 ✭✭✭


    Hey,

    I am developing an XML / CSS Flash application and I am having an extremely frustrating problem where the XML content loads fine, but the stylesheet will not apply to the document.

    I have checked the server logs and the swf requests the stylesheet and gets response code 200 (i.e. success), but the document remains the default text.

    The code I am using to load both they style sheet and XML are as follows:
    // Set TextArea properties
    theNews.border_mc._visible = false;
    theNews.html = true;
    theNews.wordWrap = true;
    theNews.multiline = true;
    theNews.label.condenseWhite=true;
    
    // Load Style Information
    newsStyle = new TextField.StyleSheet();
    newsStyle.load("content/sample.css");
    newsStyle.onLoad = function(loaded) {
    	if (loaded) {
    		theNews.styleSheet = newsStyle;
    	}
    }
    
    // Load Content
    newsContent = new XML();
    newsContent.ignoreWhite = true;
    newsContent.load("content/loadtext.php");
    newsContent.onLoad = function(success)
    {
            if(success)
            {
                    theNews.text = newsContent;
            }
    }
    

    theNews is the name of the TextArea I am loading the XML into. I have looked at the PHP document that generates the XML and it comes out as a perfectly formatted XML document.

    I just cannot understand why it will not work for me, and I am personally tearing my hair out here :p It's the very last thing to do and then the site is finished :(

    Does anybody have any idea what the problem could be? I have searched through dozens of Flash MX 2004 tutorials about external stylesheets etc, but nothing has really helped.

    Many thanks,

    Serb


Comments

  • Registered Users Posts: 2,158 ✭✭✭Serbian


    I take it nobody know so? :)

    Well, I found a way to hard code the style sheets into the FLA file itself. Not desirable as it will make things that little bit more awkward when the syles need to be changed, but I can't seem to get it to work any other way :(

    For anyone who cares, you can hard-code stylesheets like so:
    var docStyleSheet = new TextField.StyleSheet();
    docStyleSheet.setStyle("empty", {fontFamily:'Verdana', fontSize:10, color: '#666666'});
    docStyleSheet.setStyle("date", {fontFamily:'Verdana', fontSize:10, color: '#666666'});
    flash_element.styleSheet = docStyleSheet;
    

    Regards,

    Serb


Advertisement