We help IT Professionals succeed at work.
Get Started

How do I pass the variable to the SWF file?

jedijson1
jedijson1 asked
on
392 Views
Last Modified: 2012-05-09
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?
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE