1 Reply Latest reply on Jul 19, 2007 1:50 PM by Newsgroup_User

    Pass URL Parameters from HTML to Flash Button

    Scot_Snyder
      Pretty new to action script and I tried to do as suggested by Paul Whitham:
      http://www.adobe.com/devnet/dreamweaver/articles/flash_buttons.html#

      However, I can not get the swf file to load a variable to open the PDF file - here is the code I'm using.

      HTML: page name "home.htm"
      " http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="210" height="164">
      <param name="movie" value="flash/asset_strategy.swf">
      <param name="quality" value="high">
      <param name= "flashvars" value="passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>
      <embed src="flash/asset_strategy.swf" quality="high" pluginspage=" http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="210" height="164" flashvars="passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"></embed>

      Action Script:
      var passURL:String = "home.htm";
      press_btn.onRelease = function() {
      var urlString:String = passURL; getURL(urlString,"");
      }
        • 1. Re: Pass URL Parameters from HTML to Flash Button
          Level 7
          Hi Scot,

          At first glance your embedding code looks correct. This may simply be a
          scoping issue with the passURL variable. Try doing it like this instead:

          var passURL:String = "home.htm";
          press_btn.onRelease = function() {
          var urlString:String = _root.passURL; getURL(urlString,"");
          }

          -OR-

          var passURL:String = "home.htm";
          press_btn.onRelease = function() {
          var urlString:String = _level0.passURL; getURL(urlString,"");
          }

          If that doesn't work, you may want to prepend your flashvars with a
          proper URL-encoded delimiter. Either:

          <param name= "flashvars"

          value="&passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>

          -OR-

          <param name= "flashvars"

          value="?passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>


          If all else fails, examine what's actually making it into the SWF. Use this:

          for (var item in _level0) {
          trace (item+' = '+_level0[item]);
          }

          This will require follow-up since it may be something else that's wrong
          at this point.

          Regards,
          Patrick

          Scot Snyder wrote:
          > Pretty new to action script and I tried to do as suggested by Paul Whitham:
          > http://www.adobe.com/devnet/dreamweaver/articles/flash_buttons.html#
          >
          > However, I can not get the swf file to load a variable to open the PDF file -
          > here is the code I'm using.
          >
          > HTML: page name "home.htm"
          >
          > " http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0
          > ,28,0" width="210" height="164">
          > <param name="movie" value="flash/asset_strategy.swf">
          > <param name="quality" value="high">
          > <param name= "flashvars"
          > value="passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"/>
          > <embed src="flash/asset_strategy.swf" quality="high"
          > pluginspage=" http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Versio
          > n=ShockwaveFlash" type="application/x-shockwave-flash" width="210" height="164"
          > flashvars="passURL=http://www.scotsnyder.com/ivy/pdf/as_conference_call.pdf"></e
          > mbed>
          >
          > Action Script:
          > var passURL:String = "home.htm";
          > press_btn.onRelease = function() {
          > var urlString:String = passURL; getURL(urlString,"");
          > }
          >