...

Rotating flash ad banners...

chump2877
02-16-2005, 01:13 AM
General question: What is the best way to rotate flash ad banners on a web site?

I've tried to do it with both PHP and javascript, but I can't seem to configure a script that will accomodate all the "junk" inside my HTML <object> tags, which is required to make the flash banners execute properly....

It seems it is much easier to rotate image files than flash files, because to call an image file all you need to code is a simple <img src="">....

For example, it would be much easier to rotate banners within a script if I could just call the name of the .swf file directly:

<embed src="tool_banner.swf" quality="high" bgcolor="#ffffff" width="800" height="38" name="tool_banner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

instead of including all of the HTML surrounding the .swf file as well:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="800" height="38" id="tool_banner" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="tool_banner.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="tool_banner.swf" quality="high" bgcolor="#ffffff" width="800" height="38" name="tool_banner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

This extra HTML is automatically outputted by Flash MX when you publish a flash scene for the web....but I can't figure out how to make the .swf file run without including the surrounding HTML....

Can anyone here help me with my dilemma?

Thanks.

rmedek
02-16-2005, 03:07 AM
I'm not sure I understand the problem completely... could you use a php script to randomize the .swf file, and then call that file name in the .php page within the static code?

chilipie
02-16-2005, 08:25 AM
Something like this? (I'm not sure the syntax is correct, but I think the basic idea is... :o )

<?php

$rand = mt_rand(1,2);

switch ($rand) {

case 1:
$location = 'mymovie.swf';
$bgcolor = '#ffffff';
break;

case 2:
$location = 'toolbar.swf';
$bgcolor = '#000000';
break;

?>


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="800" height="38" id="tool_banner" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<?php echo $location ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="<?php echo $bgcolor ?>" />
<embed src="<?php echo $location ?>" quality="high" bgcolor="<?php echo $bgcolor ?>" width="800" height="38" name="tool_banner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Again, I'm not completely sure what I'm doing, but... ;)

rmedek
02-16-2005, 08:27 AM
Again, I'm not completely sure what I'm doing, but... ;)

I was going to type up an example, but I'm a big php noob, so I was waiting for someone else to do it... you're a braver man than I:D:D

chilipie
02-16-2005, 08:35 AM
Hehe :D :p .

chump2877
02-17-2005, 09:30 PM
thanks for responding, guys...I ended up writing something like this:

<?
srand ((double)microtime()*1000000);

// from 1 to the number of ads
$random_num = rand(1, 4);
$include_ad = "flash_banner" . $random_num . ".swf";
?>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="800" height="38" id="tool_banner" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<? echo $include_ad; ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="<? echo $include_ad; ?>" quality="high" bgcolor="#ffffff" width="800" height="38" name="tool_banner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

And then I renamed all my flash banners "flash_banner1.swf", "flash_banner2.swf", "flash_banner3.swf", and on and on....

lixoo
03-23-2005, 06:43 PM
I have tried using your code above but it doesnt seem to work - the php used to reference the flash file, see below, seems to be

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="286" height="225" id="286x225_how_to_music2" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<? echo $include_ad; ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffff00" />
<embed src="<? echo $include_ad; ?> quality="high" bgcolor="#ffff00" width="286" height="225" name="286x225_how_to_music2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

Can you help!!

thanks

_Aerospace_Eng_
03-23-2005, 08:54 PM
your missing a quote...
<embed src="<? echo $include_ad; ?>" quality="high" bgcolor="#ffff00" width="286" height="225" name="286x225_how_to_music2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

lixoo
03-24-2005, 11:27 AM
Hi...

thanks for replying. It still doesnt work!!

<? php
srand ((double)microtime()*1000000);

//from 1 to the number of ads
$random_num = rand(1, 3);
$include_ad = "flash_banner" . $random_num . ".swf";
?>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="286" height="225" id="286x225_how_to_music2" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="<? echo $include_ad; ?>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffff00" />
<embed src= "<? echo $include_ad; ?>" quality="high" bgcolor="#ffff00" width="286" height="225" name="286x225_how_to_music2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>



Do i need anything in the head tag to indicate that php is going to be used - sorry I have never used php before!!

thanks

Dumai
04-03-2005, 04:03 PM
Someone wrote me this script which allows me to switch to a pure HTML page or
Flash embedded HTML page. Now I would like to use the script above to rotate my SWF files, but starting from " ECHO SRAND " I am having trouble coding it right.

Can anyone help me fix this, code below?

---------------------------------------------------------------------------

<?php
if ($_GET['choice']=="html"){
$_SESSION['format']=="html";
} elseif ($_GET['choice']=="flash") {
$_SESSION['format']=="flash";
}

if ($_SESSION['format']=="html") {
echo "<img src=\"images/fso_hometest.jpg\" width=\"776\" height=\"256\">";

}
elseif ($_SESSION['format']=="flash"){
$_SESSION['format']=="flash";

echo

srand ((double)microtime()*1000000);

//from 1 to the number of ads
$random_num = rand(1, 3);
$include_ad = "flash_banner" . $random_num . ".swf";


"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"776\" height=\"256\" id=\"tool_banner\" align=\"middle\">
<param name=\"allowScriptAccess\" value=\"sameDomain\" />
<param name=\"movie\" value=\"<? echo $include_ad; ?>\" />
<param name=\"quality\" value=\"high\" />
<param name=\"bgcolor\" value=\"#ffffff\" />
<embed src=\"<? echo $include_ad; ?>\" quality=\"high\" bgcolor=\"#ffffff\" width=\"776\" height=\"256\" name=\"tool_banner\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
</object>";
}
?>

AusNetIT
07-03-2009, 02:14 PM
Hi All,

How do i create this featurd movie like below web site?

http://www.360south.com.au/

Thanks,



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum