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 7 of 7
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,457
    Thanks
    15
    Thanked 0 Times in 0 Posts

    have flash load after the site

    Is there anyway to set it that the flash loads after the rest of the site?

  • #2
    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
    Why would you want to do this? You could I guess use some javascript that writes the object tags to the page. You could call an onload in the body tag though I'm not exactly sure when the onload actually loads.

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,457
    Thanks
    15
    Thanked 0 Times in 0 Posts
    I would want to do it because it's a flash ad banner on the top and it is slowing down the whole page from loading.

  • #4
    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
    Place a span tag where you want the flash to appear.

    Code:
    <span id="the-ad"></span>
    Then in your head tags add this
    Code:
    <script type="text/javascript">
    <!--
    function loadFlash(){
    document.getElementById('the-ad').innerHTML='<object type="application/x-shockwave-flash" data="your-movie.swf" width="700" height="100">'
    +'<param name="movie" value="your-movie.swf">'
    +'</object>';
    }
    //-->
    </script>
    And in your body tag add this
    Code:
    onload="loadFlash()"
    so your body tag looks like this
    Code:
    <body onload="loadFlash()">
    or if you can don't even put the ad on the page.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #6
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanx very much Aerospace!

    Your script does the trick!

  • #7
    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
    My method is outdated and I recommend doing something different. I suggest you use swfobject 2.0

    It has a function that you call when you want the flash to load. I suggest placing that function in a window.onload call. You will need swfobject 2.0 for this.

    Code:
    <script type="text/javascript">
                            var flashvars = {};
    			var params = {};
    			var attributes = {};
    			attributes.id = "myflash";
    window.onload = function()
    {
    			swfobject.embedSWF("myflash.swf", "theflash", "320", "240", "9.0.0", false, flashvars, params, attributes);
    }
    </script>
    <div id="theflash">Alternate content</div>
    Last edited by _Aerospace_Eng_; 12-30-2009 at 03:02 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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