0

I've got a couple of SWF Objects (a clock and a date) to show on a live site, now I am trying to set the site on localhost, but the swf objects disappeared. I tried to put the site on a subdomain, everything works, but I tried and searched on how to make those swf work on local but no success.

Can someone please share some light on how come those swfObjects disappeared on the localhost/wampv only?

SWF objects on index.php

<div id="time">
<?php embed_flash("swf/clock.swf", CLOCK_WIDTH, CLOCK_HEIGHT, "8", '', "flashcontent");?>
<?php embed_flash("swf/date.swf", DATE_WIDTH, DATE_HEIGHT, "8", '', "flashcontent_date");?>
</div>

Here is the code for Flash_function.php

<?php
function embed_flash($name, $w, $h, $version, $bgcolor, $id)
{
$cacheBuster = rand();
$padTop = $h/3;
?>
<style>
a.noflash:link, a.noflash:visited, a.noflash:active {color: #1860C2; text-decoration: none; background:#FFFFFF;}
a.noflash:hover {color:#000; text-decoration:none; background:#EEEEEE;}
.message { width: <?=$w;?>px; font-size:12px; font-weight:normal; margin-bottom: 10px; padding: 5px; color: #EEE; background: orange;"}
</style>
<div id="<?=$id;?>" align="center">

    <noscript>
    <div class="message">
    Please enable <a href="https://www.google.com/support/adsense/bin/answer.py?answer=12654" target="_blank" class="noflash">&nbsp;JavaScript&nbsp;</a> to view this page properly.
    </div>
    </noscript>

    <div class="message">
    You need to update your Flash plugin. Click <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW" target="_blank" class="noflash">&nbsp;here&nbsp;</a> if you want to continue.
    </div>

</div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("<?=$name;?>", "<?=$w;?>", "<?=$h;?>", "<?=$version;?>", "<?=$bgcolor;?>","<?=$id;?>" );
so.addParam("quality", "high");
so.addParam("allowScriptAccess", "sameDomain");
so.addParam("scale", "showall");
so.addParam("loop", "false");
so.addParam("wmode", "transparent");
so.write("<?=$id;?>");
// ]]>
</script>

I checked Firebug of the site, so on the live site, the code shows like

<div id="flashcontent_date" align="center">
<embed id="undefined" width="240" height="50" wmode="transparent" loop="false" scale="showall" allowscriptaccess="sameDomain" quality="high" name="undefined" src="swf/date.swf" type="application/x-shockwave-flash">
</div>

but on the localhost it shows like

<div id="<?=$id;?>" align="center">
<embed id="<?=$w;?>" width="<?=$h;?>" height="<?=$version;?>" wmode="transparent" loop="false" scale="showall" allowscriptaccess="sameDomain" quality="high" bgcolor="<?=$id;?>" name="<?=$w;?>" src="<?=$name;?>" type="application/x-shockwave-flash">
</div>

Anything I am doing wrong, any help is appreciated.

1 Answer 1

1

@SamIAm, did you verify that PHP is installed and configured on the localhost? what happens when you run this script in a test page on that?

<?php phpinfo(); ?>

It looks like SWF object is passing in the PHP code that has not been processed by the PHP engine yet, so it doesn't have your variables.

To confirm, try manually entering the Flash Vars into another page on the localhost and verify the SWFObject loads correctly, that should also confirm my theory above or not.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Golfman, thanks for your response. When I run <?php phpinfo(); ?> , it came up info about PHP Version 5.3.10, which part of it should I be looking at? I did localhost/sitename/swf/clock.swf, the clock does show up. Which part of code do I manually enter the Flash Vars into another page? Anything else I can do to identify the problem? Thank you.
OK, then PHP is configured. Next I would try to change these <?=$name;?> to use echo to output the variable instead <? echo $name; ?>.
I changed all these <?=$name;?> to <? echo $name; ?> in flash_function.php, unfortunately it didn't work. Any other thoughts? Also I installed my wamp/localhost onto the D drive instead of C drive. Would that make any diferences? As I can see Configuration File (php.ini) Path C:\Windows Loaded Configuration File D:\wamp\bin\apache\Apache2.2.21\bin\php.ini on the php info. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.