|
Web 2.0 is all about sharing information, interacting and collaborating on the web. Many web services as provided by Google, Facebook or Twitter are used on a day-to-day basis by millions of people worldwide. With mobile devices on their way to become the dominant access mode, there is a growing demand for connected mobile applications... and a huge opportunity for mobile developers in combining multiple web services into value-added applications called mashups.
Guess what? That is exactly where ELIPS Studio can help.
Indeed, ELIPS Studio brings the power of ActionScript programming to Mobile developer which greatly facilitates the migration of a mobile applications into mashups. Features like posting application data to Facebook or searching Google and Twitter for information are at hand.
There are actually two ways for an ELIPS Studio developer to make his application communicate with a web service: HTTP Request and ActionScript classes.
HTTP Request
Mainstream Web 2.0 service providers — including Yahoo, Google and Facebook — adopted the easy-to-use REST design model to expose their services. The basic principle of the RESTful approach being:
- the Client sends a request to the web service over the Hypertext Transfer Protocol (HTTP) that is commonly used on the web.
- the Server sends back a response message generally expressed in an Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format.
In ELIPS Studio, an HTTP request can be achieved using the URLLoader & URLRequest classes. See the above sample code:
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
private function webServiceRequest(webServiceURL:String):void
{
var urlLoader:URLLoader = new URLLoader();
var urlRequest:URLRequest = new URLRequest(webServiceURL);
urlLoader.addEventListener(Event.COMPLETE, onServerResponse);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onServerError);
urlLoader.dataFormat = "text";
urlLoader.load(urlRequest);
}
The web server response can then be processed when the COMPLETE event is received:
- XML objects can be handled with the XML class.
- JSON-encoded responses can also be processed using the open source JSON ActionScript library from Adobe.
See an example of client app sending a Google search request over HTTP and processing the JSON response on the samples page: Web service sample app: Google Search.
ActionScript classes
Web API is another way of interacting with web services using high-level, developer-friendly API. Web API are available for many web services in various programming languages, among which ActionScript is well represented. Indeed, ActionScript classes are available for a wide range of massively adopted web services like Facebook, MySpace or eBay. Check this good blog entry about how ActionScript Libraries Help Mashing up the Web 2.0 Platforms.
The ability to reuse such web service ActionScript classes in ELIPS Studio brings tremendous benefits to mobile developers. It makes their life easier and shorten the development time.
The limitation is that ActionScript classes MUST be imported in source the project for ELIPS Studio to be able to compile them natively. SWC file are not supported. Moreover a lightweight adaptation may be required.
None-the-less, there is a all bunch of open source libraries out there that you will be able to use in your projects. Just to name few:
As an example, find on the samples page the Twitter client sample app that makes use of twitterscript ActionScript class.
Unlimited combinations
Having said that, think of all those Web 2.0 services that can be combined to turn your mobile apps into exciting and addictive mashups. So free your imagination with ELIPS Studio...
|
Comments