A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: adding background color to SWFObject

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    4

    adding background color to SWFObject

    Does anyone know how to add a bgcolor param to a dynamic SWFObject?

    I am thinking that by adding a bgcolor to my SWF or making the wmode transparent, that it will get rid of the ugly "white box"...

    Here's my URL:
    www.ashelighting.com

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    SWFObject has some pretty good documentation: http://code.google.com/p/swfobject/wiki/documentation

    So, for a background color...

    Code:
    <script type="text/javascript">
    var params = {
      bgcolor: "#ffcc33"
    };
    
    swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0","", "", params);
    
    </script>

  3. #3
    Junior Member
    Join Date
    Sep 2008
    Posts
    4
    rdoyle720 - Thank you for your suggestion. While I have not yet published a version with this code, I tried it locally and noticed that the alternative content was beating out the Flash content. I did not change the version from "8.0.0" to "9.0.0" because I did not think it was necessary. Is this supposed to happen with params bgcolor?

    If so, thank you for passing on the documentation for SWFObject. Do you think that I should try the static method?

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Works just fine for me. Here's an example I tried on my own machine:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script src="swfobject.js" type="text/javascript"></script>
    <script type="text/javascript">
    var params = {
      bgcolor: "#ffcc33"
    };
    
    swfobject.embedSWF("test.swf", "myContent", "550", "400", "10","", "", params);
    
    </script>
    </head>
    
    <body>
    
    <div id="myContent">blah</div>
    
    
    </body>
    </html>

Tags for this Thread

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center