turn off swfobject via url param

9 views
Skip to first unread message

carbon

unread,
Jul 21, 2009, 2:23:23 AM7/21/09
to SWFObject
hi there,

is there a way or modifying swfobject be turn off and view the back-up
without disabling js?

ie. http://www.flash.com?swfobject=off

Aran Rhee

unread,
Jul 21, 2009, 3:12:14 AM7/21/09
to swfo...@googlegroups.com
Yes (if you are using the dynamic publishing method).
 
You can just wrap your embedSWF() call inside a function which takes a parameter as to whether run or not:
 
//pseudo code (untested)
 
...
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
function shouldShowFlash()
{
  // read querystring value and embed flash based on value
  if (swfobject.getQueryParamValue("showflash")=="false")
  {
    alert("I should NOT embed flash ! (just show alt content)");
  }
  else
  {
    alert("I should embed flash now!");
    swfobject.embedSWF("some.swf", "myAlternativeContent", "800", "600", "9.0.0", false, flashvars, params, attributes);
  }
}
 
//call shouldShowFlash method when page DOM is ready
swfobject.addDomLoadEvent(shouldShowFlash);
</script>
....
 
<div id="myAlternativeContent">Alternative content</div>
...
 
 
 
Aran

Reply all
Reply to author
Forward
0 new messages