2 Replies Latest reply on Feb 25, 2009 11:25 PM by kglad

    loading google Maps issue part 2

    AttaBoy2 Level 3
      I found an example of using the ExternalInterface class to pass text to AS2 but I'm stuck on how to pass a google map to a movie clip.
      Here's the html part:
      <html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>fi</title>
      <script src=" http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAREqiX-rchDAf5rxchuz6dBRqQJ_ot KK68KcaQrOr8j2RiVYalRQjpWPmQ3DjfT01fj8K-cd-ZGo5rg"
      type="text/javascript"></script>
      <script type="text/javascript">

      //<![CDATA[

      function load() {
      if (GBrowserIsCompatible()) {
      var map = new GMap2(document.getElementById("map"));
      map.setCenter(new GLatLng(37.125, -122.127), 13);
      }
      }

      //]]>
      </script>

      </head>
      <body bgcolor="#ffffff">
      <!--url's used in the movie-->
      <!--text used in the movie-->
      <!-- saved from url=(0013)about:internet -->
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="fi" align="middle">
      <param name="allowScriptAccess" value="sameDomain" />
      <param name="movie" value="fi.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="fi.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="fi" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />
      </object>
      </body>
      </html>
      : here's the AS:
      import flash.external.*;
      var depth:Number = this.getNextHighestDepth();
      var mapHolder:MovieClip = new MovieClip();
      mapHolder = this.createEmptyMovieClip("mapHolder_" + depth, depth);

      var btn:MovieClip = createButton(100, 30, 0xCCCCCC);
      btn.onPress = function() {
      mapHolder.loadMovie = function():MovieClip {
      var clip:MovieClip = new MovieClip();
      clip = MovieClip(ExternalInterface.call("load"));
      return clip;
      }
      }

      function createButton(width:Number, height:Number, color:Number):MovieClip {
      var depth:Number = this.getNextHighestDepth();
      var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);
      var mcFmt:TextFormat;

      mc.beginFill(color);
      mc.lineTo(0, height);
      mc.lineTo(width, height);
      mc.lineTo(width, 0);
      mc.lineTo(0, 0);

      mcFmt = new TextFormat();
      mcFmt.align = "center";
      mcFmt.bold = true;

      mc.createTextField("mcTxt", depth, 0, 0, width, height);
      mc.mcTxt.text = "Call JS Function";
      mc.mcTxt.setTextFormat(mcFmt);

      return mc;
      }