views:

223

answers:

1

I'm trying to load a flash file using 'AC_FL_RunContent' like below. But the file will only load if I hardcode the param into the 'src'. It doesn't work if I try to dynamically concatonate using a javascript variable as below..

I have tried..

.. Constructing the src path outside the call to AC_FL_RunContent, including trying the .Replace method

.. ensuring the variable is a string with .toString() method.

Any thoughts or people with similar problems?

-- Lee

<script language="javascript">
if (AC_FL_RunContent == 0) {
 alert("This page requires AC_RunActiveContent.js.");
} else {
 AC_FL_RunContent(
  'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
  'width', '500',
  'height', '188',
  'src', 'VarTest01?param=' + myParam,
  'quality', 'high',
  'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
  'align', 'middle',
  'play', 'true',
  'loop', 'true',
  'scale', 'showall',
  'wmode', 'window',
  'devicefont', 'false',
  'id', 'VarTest01',
  'bgcolor', '#dacbb4',
  'name', 'VarTest01',
  'menu', 'true',
  'allowFullScreen', 'false',
  'allowScriptAccess','sameDomain',
  'movie', 'VarTest01',
  'salign', ''
  ); //end AC code
}

A: 

Flash's entire system for embedding swf's has been screwed up from the beginning. I've had consistent issues doing the very thing you are attempting. Adobe has more or less admitted this defect by saying that as of Flex 4, they are using the SwfObject JavaScript library. Unfortunately, there really isn't an easy way to get around it using their current JavaScript.

The good news, on the other hand, is that SwfObject is an open source project which is very easy to implement. The source is here. My recommendation is that you replace Adobe's 25 line monstrosity with one or two lines from this alternate library.

Christopher W. Allen-Poole