<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="307" height="119">
<mx:Script>
    <![CDATA[
    private var ctirest:URLLoader = new URLLoader();
    import flash.net.*;
        private function shorten():void{
            var url:String=uurl.text;
            var service:String="http://www.jdem.cz/get?url="+escape(url);
            var request:URLRequest = new URLRequest(service);
            ctirest=new URLLoader(request);
            ctirest.addEventListener("complete",nacteno);    
            try {
                  ctirest.load(request);    
                  vysledek.text="connecting...";
                  } catch (error:Error) {
                      vysledek.text="err";
                  }
        }
        private function nacteno(event:Event):void{
             vysledek.text=ctirest.data;
         }
        
    ]]>
</mx:Script>
    <mx:Button y="66" label="Zkrátit" horizontalCenter="0" click="shorten();"/>
    <mx:Label y="96" text="Label" horizontalCenter="0" id="vysledek"/>
    <mx:TextInput y="36" horizontalCenter="0" text="http://" id="uurl" width="286"/>
    <mx:Label y="10" text="Jdem.cz konvertor" horizontalCenter="0"/>
    
</mx:Application>