load XML fail?

by andrewexex886
♥0 | Line 39 | Modified 2011-09-28 18:09:11 | MIT License | (replaced)
play

ActionScript3 source code

/**
 * Copyright andrewexex886 ( http://wonderfl.net/user/andrewexex886 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/A0Be
 */

package {
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.system.Security;
    import flash.text.TextField;
    public class FlashTest extends Sprite {
        
        // Wrap url in proxy parameter.
        private function proxy(url:String):String {
            return 'http://www.gmodules.com/ig/proxy?url=' + encodeURIComponent(url);
        }
        
        public function FlashTest() {
            if (stage) {
                Security.allowDomain('www.gmodules.com');
                var l:Loader = new Loader();
                l.load(new URLRequest(proxy(loaderInfo.url)));
                addChild(l);
                return;
            } else {
                Security.allowDomain('swf.wonderfl.net');
                addEventListener(Event.ADDED_TO_STAGE, init);
            }
        }
        
        private function init(e:Event):void {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            var ul:URLLoader = new URLLoader(new URLRequest(proxy('http://dl.dropbox.com/u/7334821/Dictation_Machine_Vocabulary.xml')));
            ul.addEventListener(Event.COMPLETE, complete);
        }
        
        
        
        
        
        
        
        
        private function complete(e:Event):void {
            var xxx:XML=XML(e.target.data);
            var tf:TextField = new TextField();
            tf.width = stage.stageWidth;
            tf.height = stage.stageHeight;
            tf.text = xxx;
            addChild(tf);
        }
        
    }
}

Forked