My favorites | Sign in
Logo
                
People details
Project owners:
  joris.timmerman

Google API - Actionscript 3 library

About

The library is a simple collection of Google's API features, there is a class per feature, like Google Web search, Images Search, Google Suggest etc. Each library throws it’s own event with an Array or Value Object of matching datatype(s), for example GoogleWebItem, so it’s easy to keep track on wich data is recieved and what this data contains, giving the developer transparency using Intellisense.

Contains

This api contains:

Compatibility

This API is Flash & Flex compatible using Actionscript 3 (FP9 & 10).

Documentation

You can find the documentation under downloads > documentation. It's also archived in the downloadable source-zip (under the docs directory) and can also be found under the docs folder in the trunk of the SVN.

Little example code

var googleWebSearch:GoogleWebSearch=new GoogleWebSearch();
googleWebSearch.search(txtInput.text,0,lang);
googleWebSearch.addEventListener(GoogleSearchEvent.WEB_SEARCH_RESULT,onWebResults) ;

//You're now able to catch the API errors yourself:
googleWebSearch.addEventListener(GoogleAPIErrorEvent.API_ERROR,onAPIError)

private function onWebResults(e:GoogleSearchEvent):void{
	var resultObject:GoogleSearchResult=e.data as GoogleSearchResult
	trace("Estimated Number of Results: "+resultObject.estimatedNumResults)
	trace("Current page index: "+resultObject.currentPageIndex)
	trace("Number of pages: "+resultObject.numPages)

	for each (var result:GoogleWebItem in resultObject.results){
		trace(result.title, result.url)
	}

	/* Before version 2.0.1
	* for each (var result:GoogleWebItem in e.data as Array){
	*      trace(result.title, result.url)
	* }*/
}

private function onAPIError(evt:GoogleAPIErrorEvent):void{
	trace("An API error has occured: " + evt.responseDetails, "responseStatus was: " + evt.responseStatus);
}

Dependencies

This library uses certain classes (for example JSON-decoding), found in the AS3CoreLib by Mike Chambers, Daniel Dura and Christian Cantrell. These classes can be checked out or downloaded here: http://code.google.com/p/as3corelib

Versions

If possible, checkout the latest source via SVN. SVN Clients I would recommend:

Latest changelog

2.0.1 to 2.0.2

New









Hosted by Google Code