Community & Support

Replacing a jpg banner with a flash/swf one

Hi,

I would like to replace a jpg banner with a flash / swf one. So far I have only managed to do so by replacing the jpeg with an Animated GIF (CSS / background) though the quality of the image is way below standard.

Can anyone help me out?

Thanks

Tacha

Comments

Did you ever accomplish this?

Did you ever accomplish this? I'm interested in learning how to do this myself...

-Blake

What what? Should be to

What what? Should be to difficult, how is the jpg banner being implemented..... Is it in the theme tpl files? or inserted via a WYSIWYG editor? Either way, there are many ways to do it and modules such as swftools are quick good, if not a little bloated with functionality for my liking.

Leave more details and I'll get back to you.

I'm working with the Acquia

I'm working with the Acquia Slate theme (http://drupal.org/project/themes?text=acquia%20slate). Changing the front-page image is a simple style.css one line change, but trying to change that to be a flash animation is a bit deeper than I've gone so far.

I've got swf tools installed, so getting flash animations into content, and blocks is not that difficult. But replacing that front-page image is requiring more effort.

Is this along the right directions? http://drupal.org/node/181591
I've not modified any template.php files in drupal yet - I've been mostly coming up to speed on other aspects of drupal, and learning javascript & jquery...

To answer your direct questions:

  • The existing jpeg banner is specified as a background image in style.css, like this:
    • background: transparent url('images/cropped/lh_header3.jpg') no-repeat left top;
  • The page-front.tpl.php section that appears to be handling this portion of the page looks like this:

          <div id="preface-wrapper" class="clearfix">
            <?php if ($preface_sidebar): ?>
              <div id="preface-sidebar">
                <?php print $preface_sidebar; ?>
              </div>
            <?php endif; ?>
            <?php if ($mission): ?>
              <div id="mission">
                <?php print $mission; ?>
              </div>
            <?php endif; ?>
          </div><!-- /preface-wrapper -->

    and here's the css for that "preface-wrapper" that handles the front-page image:
    #preface-wrapper {
      background: transparent url('images/cropped/lh_header3.jpg') no-repeat left top;
      height: 355px;
      margin: -33px 0 20px;
      overflow: hidden;
      position: relative;
      width: 960px;
      -moz-border-radius: 0 0 10px 10px;
      -webkit-border-bottom-right-radius: 10px;
      -webkit-border-bottom-left-radius: 10px;
    }

Any help you can offer will be significantly appreciated.
-Blake

Ill have install the theme

Ill have install the theme and have a look.

Right. I havent tried this

Right.

I havent tried this out, but looking at the page-front.tpl it looks fairly spimple. That link you pointed to is a way of doing it. I'll have a play with that tomorrow. The way of implementation in that code is a good example off on how to do things the way Drupal wants you to. I'd give it a crack.

A quick and dirty way would be to insert the object markup required to display your swf straight into the page tpl. You could do this with this tpl file as this themes is using absolute positioning to show the sidebar div. You might have some issue with z-index but that cool to sort (z-index is a stack 0 is below 1 which below 2 etc). Assign a class to the swf and set a lower z-index for and higher index to the preface-sidebar id.

Swf can be fiddly with the z-index stack so you might have to do some reading.

Good luck with your jquery learning.

I really appreciate you're

I really appreciate you're looking at this. Just your saying that link is describing the right direction to take is a significant help.

Did you guys ever get this

Did you guys ever get this working? I'm interested in it as well

Naresh Kosgi

I've been busy with other

I've been busy with other projects, so no, I've not got this working. A bit more experienced now, it should not be that hard. The swftools markup in a template sounds like the straight forward way to do this. I've just sorta cooled on Flash, with all the incompatibility issues with iPads and iPhones. I've started using simple gif and png animations instead... :(

working solution

<?php

     
<div id="preface-wrapper" class="clearfix" >

        <
div style="position:absolute; z-index:1">        
<
script language="javascript">
    if (
AC_FL_RunContent == 0) {
       
alert("This page requires AC_RunActiveContent.js.");
    } else {
       
AC_FL_RunContent(
           
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
           
'width', '960',
           
'height', '420',
           
'src', 'test',
           
'quality', 'high',
           
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
           
'align', 'middle',
           
'play', 'true',
           
'loop', 'true',
           
'scale', 'showall',
           
'wmode', 'opaque',
           
'devicefont', 'false',
           
'id', 'test',
           
'bgcolor', '#ffffff',
           
'name', 'test',
           
'menu', 'true',
           
'allowFullScreen', 'false',
           
'allowScriptAccess','sameDomain',
           
'movie', '/img/test',
           
'salign', ''
           
); //end AC code
   
}
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="960" height="420" id="test" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="/img/test.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque"><param name="bgcolor" value="#ffffff" />    <embed src="/img/test.swf" quality="high" bgcolor="#ffffff" width="960" height="420" name="test" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
</noscript></div>

 
        <?php if ($preface_sidebar):
?>

<?php
print $preface_sidebar;
?>

<?php
endif;
?>

?>

Menu

With this solutions the menu over de image disappears. How can I fix that? thank you!

swf

Any solutions?

swf menu solution

Yes. Set the wmode in your flash parameters from "opaque" to "transparent".

nobody click here