Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Embedding local .swf file in AIR app

$
0
0

Hi all,

 

I want to include a small Google Maps .swf file as part of my overall HTML based AIR application and I was wondering whether anyone here has had any success in achieving this. Currently, my set up looks like this:

 

AIR xml file:

 

<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/1.5">
    <id>gmaps</id>
    <filename>gmaps</filename>
    <version>0.1</version>
    <initialWindow>
        <title>gmaps2</title>
        <content>gmaps2.html</content>
        <systemChrome>standard</systemChrome>
        <transparent>false</transparent>
        <visible>true</visible>
        <width>1200</width>
        <height>1000</height>
        <x>20</x>
        <y>20</y>
        <minimizable>true</minimizable>
        <maximizable>true</maximizable>
        <minSize>850 636</minSize>
        <resizable>true</resizable>
    </initialWindow>

 

My gmaps2.html file:

 

<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="app:/flex/GMapsController.swf">
                  <param name="quality" value="high">
                  <param name="flashVars" value="key=CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CC">
                  <embed
                    width="800px"
                    height="600px"
                    src="app:/flex/GMapsController.swf"
                    quality="high"
                    flashVars="key=CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCC"
                    pluginspage="http://www.macromedia.com/go/getflashplayer"
                    type="application/x-shockwave-flash">
            </object>
          </div>
    </body>
</html>

 

My GMapsController.mxml file:

 

<?xml version="1.0" encoding="utf-8"?>
<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://my.domain.com" key="CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"/>
    <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 open my air app, I don't get any error messages and it appears that the swf is not loaded at all.

 

When I switch my AIR .xml file to point to the GMapsController.swf file instead of the gmaps2.html file, it works perfectly - this gives me the impression that there's either:

 

1. Something wrong with including a WindowedApplication in a HTML file.

2. Something wrong with including a local .swf file in HTML based application.

 

I've tried referencing the .swf file in the html file from a remote server with the following:

 

  <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="app:/flex/GMapsController.swf">
                   <param name="quality" value="high">
                   <param name="flashVars" value="key=CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CC">
                   <embed
                     width="800px"
                     height="600px"
                     src="http://my.server.com/GMapsController.swf"
                     quality="high"
                     flashVars="key=CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CCCCCC"
                     pluginspage="http://www.macromedia.com/go/getflashplayer"
                     type="application/x-shockwave-flash">
             </object>
           </div>

 

but no luck with that.

 

Any help would be greatly appreciated.

 

Thanks


Sean


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>