How do I pass the variable to the SWF file?

What I'm wanting to do is pass a variable into an HTML file that uses the variable two ways:  1) it reads an XML file to display data (which it does correctly), and 2) pass the same variable on to a SWF file so that the SWF knows which FLV to pull in and display.

So, for example, let's say I want to use "textOnly.htm?pageNum=10001"

In my <head>, I have:

function getParameter(paramName){
 
  var url = ""+document.URL;
  if(url.indexOf("?") < 0 )
     return "";
  var qs = url.split('?')[1];

  var paramMap = qs.split('&');
  for(var i = 0; i < paramMap.length; i++)
  {
      var nvPair = paramMap[i].split('=');
      if(nvPair[0] == paramName)
         return nvPair[1];

  }
  return "";
}

var pageNum = getParameter("pageNum");


Currently, the pageNum will pull "10001" out of the example I used, and down in the body, I'm able to pull out the text that I want to display.

However, I cannot pass this same variable to a swf file.
<param name="movie" value="videoforHTML.swf?pageNum=' + getParameter('pageNum') + '"/>

I've tried
<param name="movie" value="videoforHTML.swf?pageNum=' + pageNum + '"/>
and it still doesn't work.

I've put quotes around pageNum in the ' + pageNum + ' section.

What am I doing wrong?  I know it's pulling the pageNum out of the header correctly, because I can alert(pageNum) and it works beautifully.  There's got to be a way to add it to the value.

Any ideas?
jedijson1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jedijson1Author Commented:
One more thing:  If I attempt to run the swf file by itself with the parameter I want (ie, videoforHTML.swf?pageNum=10001 ), it works perfectly.  So, I know that that part is fine.  I'm just trying to find out how to add the parameter in the HTML.

Thanks for all your help!
0
jedijson1Author Commented:
Never mind.  I finally figured it out.  If I change the whole area where you embed the swf file to a javascript.write function, it works perfectly with

<param name="movie" value="videoforHTML.swf?pageNum=' + getParameter('pageNum') + '"/>

Here's what I did:
<head>
<script language="JavaScript">

function getParameter(paramName){
 
  var url = ""+document.URL;
  if(url.indexOf("?") < 0 )
     return "";
  var qs = url.split('?')[1];

  var paramMap = qs.split('&');
  for(var i = 0; i < paramMap.length; i++)
  {
      var nvPair = paramMap[i].split('=');
      if(nvPair[0] == paramName)
         return nvPair[1];

  }
  return "";
}

var pageNum = getParameter("pageNum");

</head>

<body>



<div class="screenTitle" id="pageTitle" spry:region="pageData" spry:repeat="pageData">
<!--	<div spry:choose="spry:choose">-->
    <div spry:if="'{@pageNo}'==pageNum">{pageTitler}</div>
</div>
<div class="content" id="pageData">

<script language="javascript">
document.write(
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="846" height="454" id="FlashID" accesskey="P" tabindex="2" title="courseMovie">'+
  '<param name="movie" value="videoforHTML.swf?pageNum='+ getParameter('pageNum') +'" />' +
  '<param name="quality" value="high" />' +
  '<param name="wmode" value="opaque" />' +
  '<param name="swfversion" value="6.0.65.0" />' +
  '<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->' +
  '<param name="expressinstall" value="Scripts/expressInstall.swf" />' +
  '<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->' +
  '<!--[if !IE]>-->' +
  '<object type="application/x-shockwave-flash" data="videoforHTML.swf?pageNum=' + getParameter('pageNum') + '" width="846" height="454">' +
  '  <!--<![endif]--> ' +
  '  <param name="quality" value="high" /> ' +
  '  <param name="wmode" value="opaque" /> ' +
  '  <param name="swfversion" value="6.0.65.0" /> ' +
  '  <param name="expressinstall" value="Scripts/expressInstall.swf" /> ' +
  '  <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --> ' +
  '  <div> ' +
  '    <h4>Content on this page requires a newer version of Adobe Flash Player.</h4> ' +
  '    <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p> ' +
  '  </div> ' +
  '  <!--[if !IE]>--> ' +
  '</object>' +
  '<!--<![endif]-->' +
'</object>');

</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jedijson1Author Commented:
woops.  Forgot to close the <script> in the header.  Sorry.  It was cut-and-paste, and I forgot to paste it.
0
Mark_FreeSoftwareCommented:
this should work:

<param name="FlashVars"  value="myvar1=value1&myvar2=value2">
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.