My Projects
Search Blog

Categories
Archives
Photo Albums
RSS

Powered by
BlogCFM v1.15

15 August 2007
AIR Url - Adobe AIR Project

The Adobe on AIR bus tour is stopping by the Raleigh area on Saturday, courtesy of TACFUG and RDAUG, and they're having a contest.  Best AIR app wins a prize!

Well, my url shortener app may not be the best, but if I'm lucky, it'll be the only app submitted.

I've recompiled the URL shortener app as an AIR app (I built it when it was still called Apollo), and you can get it here:

Here's the source code:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
 xmlns:mx="http://www.adobe.com/2006/mxml"
 layout="absolute"
 width="400" height="68"
 creationComplete="init()">
<mx:Script>
 <![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.Fault;
import mx.controls.Alert;

import mx.utils.StringUtil;

private function init():void {
 txtLongUrl.setFocus();
}
private function genericFault(e:FaultEvent):void
{
 txtShortUrl.text = e.fault.faultString;
 btnTryIt.enabled = false;
}
private function tryUrl(url:String):void {
 navigateToURL(new URLRequest(url), '_blank');
}
private function addUrlResult(e:ResultEvent):void {
 txtLongUrl.text = '';
 txtShortUrl.text = e.result.toString();
 if (e.result.toString() != 'Invalid Source URL!') {
  btnTryIt.enabled = true;
 }
}
 ]]>
</mx:Script>
 <mx:WebService id="ro" wsdl="http://url.rickroot.com/url.cfc?wsdl" showBusyCursor="true">
  <mx:operation name="addUrl" fault="genericFault(event)" result="addUrlResult(event)"/>
 </mx:WebService>
 <mx:VBox x="10" y="10">
  <mx:HBox>
   <mx:Label text="Url to Shorten:" width="100" fontWeight="bold"/>
   <mx:TextInput id="txtLongUrl" width="200"/>
   <mx:Button id="btnDoIt" label="Do It!" click="txtShortUrl.text = ''; ro.addUrl(txtLongUrl.text);"/>
  </mx:HBox>
  <mx:HBox>
   <mx:Label text="Results:" width="100" fontWeight="bold"/>
   <mx:TextInput id="txtShortUrl" width="200"/>
   <mx:Button id="btnTryIt" label="Try It!" click="tryUrl(txtShortUrl.text);" enabled="false"/>
  </mx:HBox>
 </mx:VBox> 
</mx:WindowedApplication>

 

 

Posted by rickroot at 9:06 AM | Link | 0 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

No comments found.

Post a comment (login required)