Google Image Search API for Flash (JSON)

170 views
Skip to first unread message

Fred

unread,
Feb 12, 2011, 6:59:29 PM2/12/11
to Google AJAX APIs
I've experiemented a bit with Google Image Search API for Flash/AS3
and built a working demo of a little 'memory match game' that lets the
player use actual image results for the game. However, the game only
works in sandbox mode (Flash CS4) where the JSON parses nicely and the
images are loaded - on my server, the images sadly never load. Here's
a link to the (broken) game: http://www.abstracttravels.com/endlessmemory/index.html

I'm wondering if it has to do with the HTTP referrer header - I've
noticed that the ActionScript snippet on this page doesn't include any
referrer info, unlike all the other snippets (Java, PHP, Python,
Perl): http://code.google.com/apis/imagesearch/v1/jsondevguide.html#json_snippets_flash

Is that because Flash somehow includes referrers automatically, or
else, wouldn't it be an improvement to have a working snippet on that
page, including the http referer header?

Or could it be something else preventing the game from working? I have
a valid API Key, and display some static "Powered by Google" branding.
I'm not sending a userip (since that needs to be detected server-side,
so I'd rather avoid it as long as it isn't strictly required).

Well, I'll appreciate any help trouble-shooting this, as I think the
memory game would be a cool thing to feature on my site :)

Fred

unread,
Feb 16, 2011, 9:09:42 AM2/16/11
to google-ajax...@googlegroups.com
Again, I think the ActionScript 3.0 snippet on this page should be updated to include referer info, so it actually works: http://code.google.com/apis/imagesearch/v1/jsondevguide.html#json_snippets_flash 

Adam Feldman

unread,
Feb 25, 2011, 7:43:34 PM2/25/11
to google-ajax...@googlegroups.com, Fred
Hi Fred,

Thanks for pointing that out.  We've updated the snippet to correctly set the referer.  Please take a look and, as always, let us know if you see any other mistakes or omissions in the docs.

Have a great weekend!

Cheers,
Adam

On Wed, Feb 16, 2011 at 6:09 AM, Fred <frederi...@gmail.com> wrote:
Again, I think the ActionScript 3.0 snippet on this page should be updated to include referer info, so it actually works: http://code.google.com/apis/imagesearch/v1/jsondevguide.html#json_snippets_flash 

--
You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
To post to this group, send email to google-ajax...@googlegroups.com.
To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.

Fred

unread,
Feb 26, 2011, 12:26:42 PM2/26/11
to Google AJAX APIs
Hi Adam,

Thanks for looking at this, but it seems HTTPService doesn't really
have an addRequestHeader method. Maybe there's some other way of
adding the request header, through direct manipulation of the
'headers' property or something?

This is the compile error I get trying to use
HTTPService.addRequestHeader:

1061: Call to a possibly undefined method addRequestHeader through a
reference with static type mx.rpc.http:HTTPService.

Frederik

Adam Feldman

unread,
Mar 8, 2011, 3:10:06 PM3/8/11
to google-ajax...@googlegroups.com
Hi Fred,

Thanks again for pointing this out.  Sorry for the delay, but we've again updated the docs to 1) fix the error you were getting, 2) point out that this will only work for Flex and AIR, and 3) pointing out an open source library that will help for Flash.

Thanks for your patience!

Adam

Reply all
Reply to author
Forward
0 new messages