Skip to content


Google API – AS3 library: v. 2.0

General

I’ve been busy at work, perhaps the reason why it was so silent on this blog.
But I’m back! And one of my first act is to update the Google AS3 Library I’ve build a while ago.

I started the library to support Google’s Ajax search API.
Later on, when I found some new webservices, I added those too. At the end, the entire library was one messy organically grown library.
So I decided a while ago to clean that mess up.

Changes & new features

  • I reordened the package structure, meaning I devided the API in ajaxapi (search, translation and, the newly added, feeds), apicore (where you can store your api key), suggest (using the Google Suggest webservice) and weather (using the weather services).
  • I changed the name of the event GoogleSearchEvent to GoogleApiEvent, which is more relevant since the library is more than the Ajax search API.
  • Dito for the class that unites all features called GoogleSearch, it’s now called GoogleApi
  • As already mentioned, I also added the ability to use an api key.

I hope those changes make the library at least a bit more transparent and easier to get.

Updating

If you want to update the library your using, the easiest way is using FDT.

  1. Delete the old library and add the new one instead.
  2. Right-click your source folder, goto Source and click ‘Organize imports’.
  3. This will change your imports and correct them accordingly, so they point to the correct classes.
  4. Correct the eventname, GoogleSearchEvent becomes GoogleApiEvent. You can do that by using a find & replace, same for GoogleSearch to GoogleApi

Gimme, gimme , gimme

The classes are still on Google Code, where a new version of the library has been committed into the SVN.
The old classes have been moved to the branch folder. There is also a new update for GoogleEyes, containing the new libraries.

You can download those libraries here.
GoogleEyes demo app can be found here.

The project is hosted on Google Code (see).

Posted in AS3, Flash, Flex, google.

Tagged with , , , , .


13 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. arten says

    You go girl !
    vewy vewy nice ^^

  2. Alex says

    Translation works fine. But only if translate from English to any supported language.

    In this example translatedText=”hello” in Russian.

    googleTranslation.translate(”привет”,”ru”,”en”);

    Firebug shows me response
    {”responseData”: {”translatedText”:”??????”}, “responseDetails”: null, “responseStatus”: 200}

    translatedText – question marks

    Firebug shows me request
    http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=??????&langpair=ru%7Cen

    q – question marks too.

    In IE7, FF3 on Mac or PC – same result.

    Thanks in advance for any answer.

  3. Alex says

    I wrote: “Working fine. But only if translate from English to any supported language.”

    Problem is fixed.
    I am sorry to trouble you

  4. carl welch says

    I am having a difficult time getting this to work for me. I keep getting this error:
    1046: Type was not found or was not a compile-time constant: GoogleApiEvent.

  5. Jarek says

    Wow! This project is what I was looking for ages!

  6. Freezelight says

    very GOOD!!! =)

  7. Marcelo Marmol says

    Excelente, it saved me lot of time!!

  8. Tije says

    Excellent! Great work and works smooth apart from a few binding / security alerts that are probably my own fault.

    Thanks for your great work! Bedankt! 😉

  9. oscar says

    HI, is it possible to use your APi to access the google’s dictionary? thanks in advance.

  10. oscar says

    thank you so much for your reply.
    Best Regards, Oscar.

  11. sanane says

    not work.

  12. amit shakya says

    is there any working code available..? I tried but I am unable to understand that where I need to put API key and I am facing this error too.

    ReferenceError: Error #1065: Variable com.adobe.utils::StringUtil is not defined.
    at be.boulevart.google.ajaxapi.search.web::GoogleWebSearch/search()
    at search3_fla::MainTimeline/frame1()

    I have use your sample code…

    var googleWebSearch:GoogleWebSearch=new GoogleWebSearch()
    googleWebSearch.search(‘sun’,0,’nl’)
    googleWebSearch.addEventListener(GoogleApiEvent.WEB_SEARCH_RESULT,onWebResults)

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

  13. javier says

    Hello, I’m using it for a project, thanks!

    I’ve found sometimes:
    Error #2044: api_error no controlado: text=qps rate exceeded

    Is there any fix for this?

    Thanks again.



Some HTML is OK

or, reply to this post via trackback.