Hi

i have class for loading and parsing XML file. With test movie (command + enter) is onLoadSite method out of action. With debug mode (command + shift + enter) is all OK and in output window is possible to see trace command (trace(siteData))
What is wrong please?

package app.euro {

        import flash.display.*;
        import flash.events.*;
        import flash.net.*;

        public class Model {
                
                private var siteData:XML;
                private var xmlLoader:URLLoader;
                

                public function Model(){
                        loadSite();
                }
                
                
                private function loadSite():void
                {

                        xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, onLoadSite, false, 0, true); xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);
                        xmlLoader.load(new URLRequest("data/site.xml"));
                        
                }
                
                private function onLoadSite(evt:Event):void
                {
                        try {
                        siteData = new XML(evt.target.data);
                        trace(siteData);
                        xmlLoader.removeEventListener(Event.COMPLETE, 
onLoadSite);
xmlLoader.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
                    } catch (err:Error) {
trace("Could not parse loaded content as XML:\n" + err.message);
                    }
                }
                
                private function onIOError(evt:IOErrorEvent):void
                {
trace("An error occurred when attempting to load the XML.\n" + evt.text);
                }
                

        }

}

thanks

Pavel
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to