Ok, I figured it out. When loading it as a component within an Air/
Ajax application it still used a url parameter starting with app:/
which caused the maps API to reject the key. I changed the application
so that it loads the swf from our live server instead of from inside
the Air application - that fixed it but you might still want to have a
look at the problem as it makes it a bit difficult to develop Air/Ajax
apps.

When loading as an Air/flex app the parameters were:
url=whatever was set in the mxml
key=set in the mxml
flc=xa

When loading as an Air/ajax app the parameters were:
url=app:/path/to.swf
key=set in the mxml
flc=x

Regardless of the fact that url was set on the <maps:Map element in
both cases - email me if you need more information.

Thanks,

--
Marc Sutton
www.codev.co.uk

On Jul 30, 3:25 pm, "pamela (Google Employee)" <[email protected]>
wrote:
> Ah, apologies. The URL needs to be specified in the Map component.
> I've pasted this from the docs:
> <maps:Map xmlns:maps="com.google.maps.*" id="map"
> mapevent_mapready="onMapReady(event)" width="100%" height="100%"
>     url="http://code.google.com/apis/maps/"; key="your_api_key"/>
>
> More info 
> here:http://code.google.com/apis/maps/documentation/flash/tutorial-flexbui...
>
> - pamela
>
> On Fri, Jul 31, 2009 at 12:12 AM, Marc Sutton<[email protected]> wrote:
>
> > Thanks Pamela,
>
> > The url is of the form app:/reprieve/content/maps when it is called
> > within Air - when I load the same swf in a web page the url is of the
> > formhttp://www.reprieve.org.uk/rep... and so works with the key I am
> > using.
>
> > The same goes for using the javascript api when trying to use it in an
> > Air/Ajax app. Is there any way of getting a key for a app:/ url or
> > getting the maps API to notice the url parameter with the url to the
> > application download (as it seems to if I compile it as a standalone
> > Air/flex app)?
>
> > --
> > Marc Sutton
> >www.codev.co.uk
>
> > On Jul 30, 2:41 pm, "pamela (Google Employee)" <[email protected]>
> > wrote:
> >> Hey Marc-
>
> >> If you can check the HTTP headers that are being sent when the AIR app
> >> loads, you should be able to see the URL parameter that the SWF sends
> >> for key checking. Not sure which headers app is the best for seeing
> >> AIR requests, however.
>
> >> - pamela
>
> >> On Thu, Jul 30, 2009 at 11:30 PM, Marc Sutton<[email protected]> wrote:
>
> >> > Thanks Juguang but it still isn't working for me.
>
> >> > If I compile it as a standalone Flex application and put it in a web
> >> > page it works. If I change it to a WindowedApplication and compile it
> >> > with the Air profile it works as a standalone application.
>
> >> > But no matter what I do it won't work as an swf component embedded in
> >> > an Air Ajax application; it always displays the "Initialization
> >> > failed" message. Is there any way of finding out what url the api is
> >> > expecting to get for the given key? I suspect that might be the
> >> > problem. I can't even get it to work in debug mode where it displays
> >> > an overlay.
>
> >> > Any help would be appreciated,
>
> >> > --
> >> > Marc Sutton
> >> >www.codev.co.uk
>
> >> > On Jul 28, 3:16 pm, Juguang XIAO <[email protected]> wrote:
> >> >> Hi Marc,
>
> >> >> Have you tried it with Flex on your local machine? I did not use Maps 
> >> >> API
> >> >> with Air, so I cannot help so much. However, i suggest you first need to
> >> >> verify whether your key is correct, through testing it in Flex on your 
> >> >> local
> >> >> machine.
>
> >> >> Juguang
>
> >> >> On Tue, Jul 28, 2009 at 9:51 PM, Marc Sutton <[email protected]> wrote:
>
> >> >> > We are developing an Adobe Air application. The Air app uses html with
> >> >> > swf (compiled with flex) embedded inside it.
>
> >> >> > I'm trying to use the Google Maps for Flash API to embed a map but I
> >> >> > always get the message "Initialization failed: please check the API
> >> >> > key, swf location, version and network availability.". I have tried
> >> >> > setting the key and url values of the mxml to every possible value. I
> >> >> > suspect that because the application is not Windowed (as it is hosted
> >> >> > inside an air html app) the Google API is looking for a key with a url
> >> >> > corresponding to app:/ (the Adobe Air filesystem uri).
>
> >> >> > How can I debug this problem? Is there a call I can make to display
> >> >> > the url that the key must correspond to? Or is there a way of setting
> >> >> > url to point to the application download and authorising it that way?
>
> >> >> > Many thanks,
>
> >> >> > --
> >> >> > Marc Sutton
> >> >> >www.codev.co.uk
>
> >> >> --
> >> >> =============
> >> >> Juguang XIAO
> >> >> Beijing, China
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to