1 Reply Latest reply on Aug 19, 2008 11:04 AM by Newsgroup_User

    How to pass a variable from HTML to Flash

    Federated Films Level 1
      I have built my flash ad banner in Flash 9 and now want the HTML code to pass the url over to the flash movie that it should jump to when clicked.

      The info in the help file seems out of date for the latest HTML template as it uses mainly JavaScript to get round IE's dreadful embeding issue. So my problem is, how do I pass a variable from the HTML to the actionScript specified int he Help file (running on a full screen button) as shown below?

      myButton_btn.onRelease = function() {
      if (clickTAG.substr(0, 5) == "http:") {
      getURL(clickTAG);
      }
      };

      via the html code now used by Flash 9 which is like this:

      <!-- saved from url=(0013)about:internet -->
      <html lang="en">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Advert_long</title>
      <script language="javascript"> AC_FL_RunContent = 0; </script>
      <script language="javascript"> DetectFlashVer = 0; </script>
      <script src="AC_RunActiveContent.js" language="javascript"></script>
      <script language="JavaScript" type="text/javascript">
      <!--
      // -----------------------------------------------------------------------------
      // Globals
      // Major version of Flash required
      var requiredMajorVersion = 9;
      // Minor version of Flash required
      var requiredMinorVersion = 0;
      // Revision of Flash required
      var requiredRevision = 115;
      // -----------------------------------------------------------------------------
      // -->
      </script>
      </head>
      <body bgcolor="#ffffff">
      <!--url's used in the movie-->
      <!--text used in the movie-->
      <!--
      Coping
      with
      Growing
      Audio
      Series
      Theraputic stories
      for children aged
      4 to 9
      -->
      <script language="JavaScript" type="text/javascript">
      <!--
      if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
      alert("This page requires AC_RunActiveContent.js.");
      } else {
      var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
      if(hasRightVersion) { // if we've detected an acceptable version
      // embed the flash movie
      AC_FL_RunContent(
      'codebase', ' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
      'width', '120',
      'height', '600',
      'src', 'Advert_long',
      'quality', 'high',
      'pluginspage', ' http://www.macromedia.com/go/getflashplayer',
      'align', 'middle',
      'play', 'true',
      'loop', 'true',
      'scale', 'showall',
      'wmode', 'window',
      'devicefont', 'false',
      'id', 'Advert_long',
      'bgcolor', '#ffffff',
      'name', 'Advert_long',
      'menu', 'true',
      'allowScriptAccess','sameDomain',
      'allowFullScreen','false',
      'movie', 'Advert_long',
      'salign', ''
      ); //end AC code
      } else { // flash is too old or we can't detect the plugin
      var alternateContent = 'Alternate HTML content should be placed here.'
      + 'This content requires the Adobe Flash Player.'
      + '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
      document.write(alternateContent); // insert non-flash content
      }
      }
      // -->
      </script>
      <noscript>
      // Provide alternate content for browsers that do not support scripting
      // or for those that have scripting disabled.
      Alternate HTML content should be placed here. This content requires the Adobe Flash Player.
      <a href=" http://www.macromedia.com/go/getflash/">Get Flash</a>
      </noscript>
      </body>
      </html>