TinyURL usage with Flash Builder
Line Break
Author: Theo (4 Articles) - Author Website
Theo is a SAP Integration Specialist by day and a Webdeveloper / Web App Evangelist by night. He is the creator of "I Am Bored So I blog" and he is a member of the Board of the Dutch Flex Usergroup. With his quote "Never Give Up, Never Surrender" (Actually stolen from Galaxy Quest) he fights his way through the day.
Always wanted to use flex or air to create your tinyUrl’s ?
You making an application which should create tinyurls ?
Well look no further. Here’s the code to create smaller urls using the tiny url api.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <fx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.rpc.http.HTTPService; public var _completeService:HTTPService = new HTTPService(); //this function trows the long user url to tiny url.com public function onStartTinyUrl(event:Event):void { _completeService = new HTTPService(); _completeService.resultFormat = "text"; _completeService.addEventListener("result", testdata); _completeService.url = "http://tinyurl.com/api-create.php?url=" + yURL.text; _completeService.send(); } // this function get the data back from tiny url and places it in the textbox public function testdata(event:ResultEvent):void { var data:String = _completeService.lastResult as String; tURL.text = data; } ]]> </fx:Script> |
and
1 2 3 4 5 6 7 8 9 10 11 | <mx:Form x="10" y="10"> <mx:FormItem label="Your URL"> <s:TextInput width="216" id="yURL"/> </mx:FormItem> <mx:FormItem> <s:Button label="Go !" click="onStartTinyUrl(event)"/> </mx:FormItem> <mx:FormItem label="TinyURL"> <s:TextInput width="215" enabled="true" id="tURL" selectable="true"/> </mx:FormItem> </mx:Form> |
Which will give you this :
Related posts:
- Connect to Google Analytics from Flash Builder
- Using States in Flash Builder
- Flex 4 / Flash Builder 4: Repeater changed to DataGroup
- Call Javascript function from Flex / Flash Builder (AS3)
- Using ASDoc as an External Tool in Flash Builder 4
Comments
2 Responses to “TinyURL usage with Flash Builder”



(
Does this tutorial work with Flex Builder 3? I am reluctant to use the Beta Flash Builder.
Yes I think so. There are no real Flash Builder items in this manual.