Hi Marc, Had a second look at your instructions and looks like I was barking up the wrong tree. I have it working now, by pointing my HTML at a live server and changing from a WidowedApplication to a straight Application. This is what my final configuration looks like:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" / > <title>GMAPS</title> </head> <body> <div id="map_canvas" name="map_canvas"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=6,0,29,0" width="800px" height="600px"> <param name="movie" value="http://myserver.eye.fi/ GMapsController.swf"> <param name="quality" value="high"> <param name="flashVars" value="key=ABQIAAAAirgZjEoCu9f3suq95spKkBR_S1ecsaBoILwOJWQZL62AsG_vrBT--- yI8NYfu5nSGRvZPcpZobSHzA"> <embed width="800px" height="600px" quality="high" flashVars="key=ABQIAAAAirgZjEoCu9f3suq95spKkBR_S1ecsaBoILwOJWQZL62AsG_vrBT--- yI8NYfu5nSGRvZPcpZobSHzA" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </object> </div> </body> </html> and my .mxml file looks like: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <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="ABQIAAAAirgZjEoCu9f3suq95spKkBR_S1ecsaBoILwOJWQZL62AsG_vrBT--- yI8NYfu5nSGRvZPcpZobSHzA"/> <mx:Script> <![CDATA[ import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapType; private function onMapReady(event:Event):void { this.map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE); } public function setLocation(lat:Number, long:Number):void { } ]]> </mx:Script> </mx:Application> Curious to know from the Google people on this list what the thinking is behind these restrictions. I'd like to be able to host the .swf file internally in the AIR application so I wouldn't have to rely on an external server (other than the Google Maps servers). Would you suggest any kind of workaround to achieve what I want? Do you think what I want is realistic/possible/advisable? Thanks again Sean On Aug 3, 8:33 am, seanoshea <[email protected]> wrote: > Hi Marc, > > Tried your suggestions, but no dice. Tried changing the AIR app from a > WindowedApplication into a regular Application, but didn't have any > luck with that. > > I tried adding the .swf as the content in the AIR .xml file like this: > > <content>GMapsController.swf</content> > > and that loaded the Google Map as expected - unfortunately, this > doesn't really suit myHTMLbased application :( > > I posted to the Adobe AIR forums just to see what I'm trying to do is > actually possible:http://forums.adobe.com/thread/470957. I'm very new > to AIR/Flex development in general, so I could be making a very simple > mistake. If someone on the AIR team posts to the Adobe forums, I'll be > sure to repost back here. In the meantime, If anyone on this forum > sees something glaringly wrong with what I'm attempting to do, I'd > really appreciate it if you could point me in the correct direction. > > Cheers > > Sean > > On Jul 31, 4:25 am, Marc Sutton <[email protected]> wrote: > > > Hi Sean, > > > So I would change the line below in thehtml: > > > height="600px"> > > - <param name="movie" value="app:/GMapsController.swf"> > > + <param name="movie" value="http://someserver.com/ > > GMapsController.swf"> > > <param name="quality" value="high"> > > > And make sure the key is set to match that domain. Also you might have > > to change from WindowedApplication to Application to get it to display > > at all (possibly changing to a flex profile but I think theair > > profile worked as well). > > > It's not very elegant, it would be much better if we could use an > > app:/ url to store the swf inside theAirapplication but looking at > > the network traffic the url parameter in the mxml is always ignored by > > the maps API if you aren't running the swf as the main window in > > anAirapplication (i.e. it never gets used if you are running > > anAir/htmlapplication). > > > Love the eye-fi btw, > > > -- > > Marc Suttonwww.codev.co.uk > > > On Jul 30, 10:57 pm, seanoshea <[email protected]> wrote: > > > > Hi Marc, > > > > I'm running into the exact same issue you seemed to have overcome. > > > I've aHTMLbasedAIRapplication and I want to include GMaps > > > capabilities in a swf file within theHTMLapp. Would you mind posting > > > the code you used to import the swf into theHTMLplease? This is what > > > my import code looks like: > > > > <object > > > classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" > > > codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/ > > > swflash.cab#version=6,0,29,0" > > > width="800px" > > > height="600px"> > > > <param name="movie" value="app:/GMapsController.swf"> > > > <param name="quality" value="high"> > > > <param name="flashVars" > > > value="key=aklsjdlkasjdlaskjdaslkjdaslkdjalksdjaslkdjaslkdjaslkdjaslkdjasldkjasldkjasldkjaldkajaslkdjasldkjasldkjasldkj"> > > > <embed > > > width="800px" > > > height="600px" > > > src="app:/GMapsController.swf" > > > quality="high" > > > > flashVars="key=aklsjdlkasjdlaskjdaslkjdaslkdjalksdjaslkdjaslkdjaslkdjaslkdjasldkjasldkjasldkjaldkajaslkdjasldkjasldkjasldkj" > > > pluginspage="http://www.macromedia.com/go/getflashplayer" > > > type="application/x-shockwave-flash"> > > > </object> > > > > and this is what my mxml code looks like: > > > > <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" > > > layout="absolute"> > > > <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="aklsjdlkasjdlaskjdaslkjdaslkdjalksdjaslkdjaslkdjaslkdjaslkdjasldkjasldkjasldkjaldkajaslkdjasldkjasldkjasldkj"/ > > > > <mx:Script> > > > <![CDATA[ > > > > import com.google.maps.LatLng; > > > import com.google.maps.Map; > > > import com.google.maps.MapEvent; > > > import com.google.maps.MapType; > > > > private function onMapReady(event:Event):void { > > > this.map.setCenter(new > > > LatLng(40.736072,-73.992062), 14, > > > MapType.NORMAL_MAP_TYPE); > > > } > > > > public function setLocation(lat:Number, > > > long:Number):void { > > > > } > > > > ]]> > > > </mx:Script> > > > </mx:WindowedApplication> > > > > When I load thisHTMLapplication, I don't get any error messages > > > saying that the GMaps key is invalid or anything like that. You said > > > that hosting the swf file on a remote server worked for you - do you > > > know whether its possible to load the swf file from inside theAIR > > > app? > > > > If you have any pointers, I'd really appreciate your opinion. > > > > Cheers > > > > Sean > > > > On Jul 30, 10:20 am, Marc Sutton <[email protected]> wrote: > > > > > Ok, I figured it out. When loading it as a component within anAir/ > > > > 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 > > > > theAirapplication - that fixed it but you might still want to have a > > > > look at the problem as it makes it a bit difficult to developAir/Ajax > > > > apps. > > > > > When loading as anAir/flex app the parameters were: > > > > url=whatever was set in the mxml > > > > key=set in the mxml > > > > flc=xa > > > > > When loading as anAir/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 Suttonwww.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 > > > > > > withinAir- 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 > > > > > >> theAIRapp > > > > > >> 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 > > > > > >>AIRrequests, 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 theAirprofile it works as a standalone application. > > > > > > >> > But no matter what I do it won't work as an swf component > > > > > >> > embedded in > > > > > >> > anAirAjax 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 > > > > > >> >> withAir, 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 AdobeAirapplication. TheAirapp > > > > > >> >> > useshtmlwith > > > > > >> >> > 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 anairhtmlapp) the Google API is looking for a key with > > > > > >> >> > a url > > > > > >> >> > corresponding to app:/ (the > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
