HTML .swf help

Discussion in 'Web Design and Development' started by crimsonkid, May 20, 2008.

  1. crimsonkid macrumors member

    Joined:
    Apr 4, 2008
    #1
    Hey everyone,

    I need to insert a flash menu which is a .swf file into my html homepage.
    It is inside a CSS div tag, but I cannot manage to get it to even appear.

    If it helps the flash menu is called flash_menu.swf

    Please any help is greatly appreciated.

    Thanks
     
  2. dalvin200 macrumors 68040

    Joined:
    Mar 24, 2006
    Location:
    Nottingham, UK
    #2
    you need to use the <object> html tag to reference the .swf file..
    don't think you can do that within css (like you can with images etc..)
     
  3. crimsonkid thread starter macrumors member

    Joined:
    Apr 4, 2008
    #3
    oh sorry, I meant I created a box for it in CSS, but the actually .swf was being placed in the HTML document.

    I have tried the object tag, but need a specific classid or something as well?
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    Correct. See here for more info.
     
  5. BillyBobBongo macrumors 68020

    BillyBobBongo

    Joined:
    Jun 21, 2007
    Location:
    On The Interweb Thingy!
    #5
    I find this to be the simplest and most elegant way of adding swfs to my web pages

    Okay....download this file (right-click + save as on Windows, option-click + save linked file on OS X)

    http://www.tequilatown.co.uk/flashobject.js

    it needs to go into the root directory.

    --HTML--

    Add this

    Code:
    <script type="text/javascript" src="flashobject.js"></script>
    Into the header in the html page

    Add this

    Code:
      <div id="[B]menu[/B]">
       
    Update your Flash player to see this file!
    </div>
          <script type="text/javascript">
       var fo = new FlashObject("file_name.swf", "[B]menu[/B]", "950", "50", "8", "#000000");
       fo.addParam("quality", "high", "winmode", "transparent");
       fo.write("[B]menu[/B]");
      
    </script>
     
    where you want to see the swf file. The words in bold all relate to the DIV tag and must match!

    --CSS---

    Add

    Code:
    #menu {height:50px; width:950px; clear:both; position:inherit;}
    into your CSS (you might need to change the sizes etc for all this to work for your file...but you should know that).
     
  6. crimsonkid thread starter macrumors member

    Joined:
    Apr 4, 2008
    #6
    great, that worked perfectly
    thanks for your help
     
  7. BillyBobBongo macrumors 68020

    BillyBobBongo

    Joined:
    Jun 21, 2007
    Location:
    On The Interweb Thingy!
    #7
    You're welcome!

    As a quick side note....between you can change the text "Update your Flash player to see this file!" to anything you want. GoogleBot etc will keep this information when they search your site. I tend to just add a few words that are relevant for me site, whereas others will insert a large chunk of text relevant to the swf itself.

    Happy Flashing!
     

Share This Page