Loading a Stylesheet into a Custom Class

Help! I am trying to load an external stylesheet into a class I have created. This is my first attempt at writing a class and so far so good on loading the xml and other items needed. However, I have spent hours trying to solve this problem, referenced several threads (even on here) and haven’t found a solid solution. Below is my code. I am passing variables into it. The xml portion is perfectly fine and loading the string location of the stylesheet. its when I try to load the style sheet that it won’t load. It continues to throw the false message. :frowning:


import TextField.StyleSheet;

class LoadNewPage{
/* variables */
public var myStyle_css:StyleSheet;
public var myXML_xml:XML;
public var styleLocation_str:String;
public var containerClip_mc:MovieClip;
private var xmlFile_xml:XML;

public function LoadNewPage(container_mc:MovieClip):Void {
        containerClip_mc = container_mc; 
        myXML_xml = new XML();
        parseMyXML();
}

private function parseMyXML():Void {
        /* location of myXML_xml.xml within the folder */
        var xmlLocation_str:String = "/global/xml/myXML_xml.xml";
        xmlFile_xml = new XML();
        /* begin set up for loading of XML */
        xmlFile_xml.ignoreWhite = true;
        xmlFile_xml.load(xmlLocation_str);
        xmlFile_xml.onData = Delegate.create(this, xmlLoaded);
}
    /* function that parses the XML    */
    private function xmlLoaded(xml_str:String):Void {
        myStyle_css = new StyleSheet();
        styleLocation_str = new String();
        /* parses xml */
        myXML_xml.ignoreWhite = true;
        myXML_xml.parseXML(xml_str);
        /* gathers total number of entries in xml */
        totalEntries_num = myXML_xml.firstChild.childNodes.length;
        /* pull location of styleSheet from the XML */
        styleLocation_str = myXML_xml.childNodes[0].attributes.myStyleSheet;
         loadStyleSheet(myStyle_css, styleLocation, containerClip_mc)
}

private function loadStyleSheet(myStyle_css:StyleSheet, styleLocation_str:String, containerClip_mc:MovieClip):Void {
        /* loads external CSS document */
        myStyle_css.load(styleLocation_str);
        myStyle_css.onLoad = function(success:Boolean) {
            if (success) {
                trace("loaded CSS successfully");
                containerClip_mc.test_txt.text.styleSheet = myStyle_css;
                containerClip_mc.test_txt.text = "<so_boldedText>loaded stylesheet successfully!</so_boldedText>"+" "+success;
                checkWhichSectionIsBeingCalled();
            } else {
                trace("NOT loaded CSS");
                containerClip_mc.test_txt.text = "not loading css at all!";
            }
        }
    }
}

Any help is GREATLY appreciated. Trying to get this portion done to move on to the rest of my application.