Welcome to WebmasterWorld Guest from 54.166.87.123

Forum Moderators: phranque

Message Too Old, No Replies

embed swf flash It does not show up

   
5:05 pm on Jun 22, 2010 (gmt 0)

5+ Year Member



Hello

I have this code in the header file of a wordpress theme.

....
<?php wp_head(); ?>

<script type="text/javascript" src="../../plugins/kimili-flash-embed/js/swfobject.js"></script>
<script type="text/javascript">
var flashvars = false;
var params = {};
params.quality = "high";
var attributes = false;
swfobject.embedSWF(<?php echo "logoX.swf";?>, "logoX", "272", "321", "8.0.0",false,flashvars,params,attributes);
</script>




I have placed the swf file in the same folder as the php files of the wordpress theme.
....
</head>
<body <?php body_class(); ?>>
<div id="horizBody"></div>

<div id="logoX">
<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" />
</a>
<?php echo "<br />";?> Description
</div>

<div id="page">
....

Do you know why doesn't this code show the flash file?
Thanks
10:27 pm on Jun 22, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



<script type="text/javascript" src="../../plugins/kimili-flash-embed/js/swfobject.js"></script>
i would try an absolute url here and see if it works.

why are you using php here?
swfobject.embedSWF(<?php echo "logoX.swf";?>, "logoX", "272", "321",
<?php echo "<br />";?> Description
10:49 pm on Jun 22, 2010 (gmt 0)

WebmasterWorld Senior Member



I'm not familiar with the WP environment but in addition to the PHP there in that markup I'm also wondering if there is a compelling reason to need to use JavaScript for this?

Here's a variation that I would use that will pass WAI and W3C xhtml 1.1 validation too. I know WP is pretty good at maintaining valid W3C output so this would keep it in line. I'll leave the arguments in the string so you can get an idea of variables you can play with.

<object type="application/x-shockwave-flash" data="http://www.example.com/v/IOfyZHBcDsY&amp;hl=en_US&amp;fs=1&amp;rel=0&amp;color1=0x234900&amp;color2=0x4e9e00&amp;border=1" width="637" height="405"><param name="movie" value="http://www.example.com/v/IOfyZHBcDsY&amp;hl=en_US&amp;fs=1&amp;rel=0&amp;color1=0x234900&amp;color2=0x4e9e00&amp;border=1" /><param name="FlashVars" value="playerMode=embedded" /><span>It appears you have do not have, or have disabled, the <a href="http://get.adobe.com/flashplayer/" title="Flash Plugin" rel="external">Flash</a> plugin that is required for this presentation.</span><param name="wmode" value="transparent" /></object>
12:27 am on Jun 23, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



there are compelling reason to use flash detection methods such as swfobject, which requires javascript.
one of the most compelling reasons is to provide alternate content for flash-disabled and/or javascript-disabled browsers for accessibility reasons.
2:04 am on Jun 23, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Visualize your method as if it didn't come from PHP:

swfobject.embedSWF(logoX.swf, "logoX", "272", "321", "8.0.0",false,flashvars,params,attributes);

It's unquoted, and unless you have a javascript variable named logo.swf, it will crash and you should see an error in the FireFox Error Console here.

Your output should look like

swfobject.embedSWF("logoX.swf", "logoX", "272", "321", "8.0.0",false,flashvars,params,attributes);

so

swfobject.embedSWF(<?php echo \""logoX.swf"\";?>, "logoX", "272", "321", "8.0.0",false,flashvars,params,attributes);

might do it, if all other things are working. Also this will eventually throw you, if it hasn't already:

<script type="text/javascript" src="../../plugins/kimili-flash-embed/js/swfobject.js"></script>

If you have the directory "plugins" at domain root, use the leading slash.

<script type="text/javascript" src="/plugins/kimili-flash-embed/js/swfobject.js"></script>

That will (normally) hook it up no matter what directory you're in.

Here's a variation that I would use ...


And what do you do to get Flash to play in FireFox, which needs <embed>?
2:26 am on Jun 23, 2010 (gmt 0)

WebmasterWorld Senior Member



I only use FireFox for developing and then check it in IE and never have a problem playing it so I'm not sure what you mean. It embeds and it validates to xhtml 1.1 (HTML5).
3:01 am on Jun 23, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



how does that look on an iPhone/iPad?
or a screen reader?

how does that flash content look in google's index?
3:10 am on Jun 23, 2010 (gmt 0)

WebmasterWorld Senior Member



I really don't know. I just put it out there as an option to consider seeing as how the one he is using isn't working as expected. I guess if someone wants to use it they would probably test it on all devices they are targeting.

I simply approach it from the point of view that if W3C says it is valid then they must know that it is accessible to those devices. If it isn't then they need to reevaluate their validator. In this case I have to accept their evaluation as a guiding authority because isn't that in fact their purpose? I, and I don't think anyone else, would have the time or resources to test the hundreds of different potential devices accessing a site.
4:32 am on Jun 23, 2010 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



validation and accessibility are discrete concepts.
one aspect of accessibility is to "Provide access to alternative content." [w3.org]

Why Web professionals choose to validate:
http://validator.w3.org/docs/why.html#why_pros [validator.w3.org]
Why Web Accessibility is Important:
http://www.w3.org/WAI/intro/accessibility.php#important [w3.org]
12:03 pm on Jun 23, 2010 (gmt 0)

5+ Year Member



solved with this
<?php bloginfo('template_directory'); ?>
and kimili-flash-embed plugin.
Thank you all