Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorkevadamson
    • CommentTimeJan 23rd 2008
     
    I've noticed this problem in Firefox on my PC (XP) where swfobject is causing like a 1 or 2 second lag between page content loading when I click between pages - it leaves just a few of the CSS background images showing which is a little ugly. See: http://livshop.aguk.org/home.php?/home and click the links.
    I'm using swfobject 1.5 but it did it in 1.4 also.
    The flash is on every page.
    It doesn't do it in IE7.
    I commented out the script and navigating between the pages was nice and smoothe with no lag.

    Is this a known issue?
    Any fixes?

    Thanks
    • CommentAuthorphilip
    • CommentTimeJan 23rd 2008 edited
     
    are you talking about the pink basket?

    there are a few things going on here.

    1. you have the swfobject.js file in the body of your document. it should be in the head, where your prototype and scriptaculous files are.

    2. your flash DIV contains an image. this means you'll have to wait for the image to load before swfobject kicks in. i know of three ways to make the SWF load quicker:

    a. use your current swfobject code, but place it directly beneath the flash DIV so it loads before the rest of the page content

    b. use your current swfobject code, but place it in the head, wrapped in a domready function ('domready' performs your specified tasks -- such as loading the SWF -- when the DOM has loaded, but *doesn't* wait for images to finish loading. this requires a framework with a domready feature, such as jquery or mootools. prototype and/or scriptaculous may have it, i'm not sure as i don't use those frameworks.).

    c. use SWFObject 2.0 (beta) which has a "domready" load feature built-in. see http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation

    3. you could also use CSS to place the pink image in the DIV as a background image instead of including the image in your markup. that would speed things up with no additional javascript required.

    this

    <div id="flash">
    <h1>
    <a href="#" title="LIVERPOOL SHOP : Football / Music / Gifts / Art">
    <img src="/images/logo.gif"
    title="LIVERPOOL SHOP : Football / Music / Gifts / Art"
    alt="LIVERPOOL SHOP : Football / Music / Gifts / Art"
    width="180" height="196" />
    </a>
    </h1>
    </div>


    becomes this (i haven't tested, this is just off the top of my head. you should get the point):

    <div id="flash">
    <h1>
    <a href="#" title="LIVERPOOL SHOP : Football / Music / Gifts / Art">
    LIVERPOOL SHOP : Football / Music / Gifts / Art</a>
    </h1>
    </div>

    with css:
    #flash h1 a {
    display: block;
    width: 180px;
    height: 196px;
    background: url(/images/logo.gif) repeat-none top left;
    /* hide text */
    text-align: left;
    text-indent: -9999px;
    }


    - philip
    • CommentAuthorkevadamson
    • CommentTimeJan 23rd 2008 edited
     
    I have tried all of the above (apart from domready on 1.5) and still does the same
    2.0 does the same also

    What is causing Firefox to reload all my elements on every page when I use swfobject?

    See how in ie7 when you click on different pages it doesn't reload everything again (I'm not suggesting IE is better btw, just in this case the transition between pages is much nicer ;))
    • CommentAuthorphilip
    • CommentTimeJan 23rd 2008
     
    i just noticed you're using wmode=transparent. this causes a number of issues in Flash Player, and i from what i've heard, it also causes Flash to load last (on the top layer in the browser) regardless of your SWFObject or CSS settings.

    try loading the page without specifying wmode and see if it changes the speed/load issues you're referring to.

    i know it will mess up your visuals, but it doesn't hurt to try it for troubleshooting purposes. :)

    - philip
    • CommentAuthorkevadamson
    • CommentTimeJan 24th 2008
     
    Nope still doing it - notice grey background for a second on each page. I've checked other sites and I think it just may be the way it is ...

    What I am going to add is a var to stop it loading every page though!
    • CommentAuthorkevadamson
    • CommentTimeJan 24th 2008 edited
     
    FIXED!

    The solution (in the head):

    <script type="text/javascript">

    function addSwf(){

    var so = new SWFObject('/flash/logo.swf', 'Liverpool Shop', '780', '230', '8', '#ffffff');
    so.addParam("wmode", "transparent");
    so.write("flash");

    }

    window.onload = function(){
    addSwf()
    }

    </script>


    Thanks to Philip for looking into it for me!
    • CommentAuthorphilip
    • CommentTimeJan 24th 2008
     
    cool, glad you got it working.

    one problem: IDs can't have spaces. you should change "Liverpool Shop" to "LiverpoolShop"

    otherwise, looks good. i like the visual design on your site. :)