Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,746
    Thanks
    18
    Thanked 155 Times in 146 Posts

    Rotating flash ad banners...

    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:

    PHP Code:
    <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:

    PHP Code:
    <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.
    Last edited by chump2877; 02-16-2005 at 01:18 AM.
    Regards, R.J.

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

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    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?

  • #3
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something like this? (I'm not sure the syntax is correct, but I think the basic idea is... )
    PHP Code:
    <?php

    $rand 
    mt_rand(1,2);

    switch (
    $rand) {

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

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

    ?>
    PHP Code:
    <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...

  • #4
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by chilipie
    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

  • #5
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hehe .

  • #6
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,746
    Thanks
    18
    Thanked 155 Times in 146 Posts
    thanks for responding, guys...I ended up writing something like this:

    PHP Code:
    <?
                srand 
    ((double)microtime()*1000000);

                
    // from 1 to the number of ads
                
    $random_num rand(14);
                
    $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....
    Regards, R.J.

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

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #7
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    your missing a quote...
    Code:
    <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" />

  • #9
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #10
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>";
    }
    ?>

  • #11
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Featured Web Site Banner

    Hi All,

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

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

    Thanks,


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •