Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
//============================================================================================= public function openXML(name:String):void { //decides what XML data feed and opens it //============================================================================================= var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); var request:URLRequest = new URLRequest("http://www.gessnerengineering.com/projects"); request.method = URLRequestMethod.GET; //add event listener to URLLoader to call closeXML upon completion xmlLoader.addEventListener(Event.COMPLETE, closeXML); xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError); xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError); function onIOError(e:IOErrorEvent):void { trace("Error loading URL."); } function securityError(e:SecurityErrorEvent):void { trace("security error"); } xmlLoader.load(request); //========================================================= function closeXML(e:Event):void { //========================================================= xmlData = new XML(xmlLoader.data); xmlLoader.removeEventListener(Event.COMPLETE, closeXML); drawPage(name, xmlData); } }
This paste will be private.
From the Design Piracy series on my blog: