A while ago, I have build an API library in AS3 that interfaces with Google’s own javascript API. To show you how performant this API is, I included a demo-app at the bottom of this blog.

The library is a simple collection of the API’s features, there is a class per feature, like Google Web search, Images Search, etc. Each library throws it’s own event with an Array of matching datatypes, for example GoogleWebItem, so it’s easy to keep track on wich data is recieved and what this data contains.

This api contains:

  • Google Web Search
  • Google Images Search
  • Google Book Search
  • Google Video Search (Google Video & YouTube)
  • Google Blog Search
  • Google Local Search
  • Google Patent Search
  • Google News Search
  • Google Translation
  • Google Weather
  • Google Suggest

This API is Flash & Flex compatible.

Little example code

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

private function onWebResults(e:GoogleSearchEvent):void{
for each (var result:GoogleWebItem in e.data as Array){
trace(result.title, result.url)
}
}

The library

You can download the library here (updated).
The demo app can be found here.

Right-click in the app to see source-code.


No Tags