4 Replies Latest reply on Mar 26, 2009 11:38 PM by deep_flash

    Read variable from URL

    Level 1
      How can I read a variable from URL so that it can be used in my swf?

      I have 'main.swf' loaded in 'mainpage.html'. I am using getURL to pass variable from this swf to the URL of another html page(secondpage.html)......

      var getstr="China";

      I have this code in 'secondpage.html' .........

      <title>Second Page that loads page2.swf</title>
      <SCRIPT LANGUAGE="JavaScript" TYPE="Text/JavaScript">
      var myloc=this.location.split("?myvar=")[1];
      <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="100%" height="100%" id="page2" align="middle">
      <param name="allowScriptAccess" value="sameDomain" />
      <param name="movie" value="page2.swf?ctry="+myloc />
      <param name="quality" value="high" />
      <param name="bgcolor" value="#000000" />
      <embed src="page2.swf?ctry="+myloc quality="high" bgcolor="#000000" width="100%" height="100%" name="page2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />

      As you can see in the above code, I am trying to pass variable 'myloc' into page2.swf.
      'myloc' should contain the variable value of the URL 'myvar'
      On the first frame of my page2.swf, i used,
      var htmlVariable=this.ctry;

      ... but doesn't seem to work :(

      I will be greatful if you could help me.