Delay Flash Loading

Discussion in 'HTML & Website Design' started by SEbasic, Dec 21, 2004.

  1. #1
    Hi guys,

    I have a client site that I finished a few days ago, but having only tested in on the internal network, I didn't take into account the flash movie that needs to load too.

    Basically, I want to have the Flash movie load after everything else on the page (HTML) has loaded.

    Is there a bit of script or code that I can use that will basically tell someone's browser to render the flash after everything else on the page has been rendered, and not before?

    Anyone ever had to do something similiar in the past?

    Cheers

    Oliver.
     
    SEbasic, Dec 21, 2004 IP
  2. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First off does your Flash have a pre-loader?

    Second, I don't know how to make it load after the page renters. Just make a pre-loader and you should be fine.
     
    TwisterMc, Dec 21, 2004 IP
  3. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I actually just sorted it...

    No, the flash doesn't have a preloader, but what you can do, is wrap the swf in it's own div, assign it a display:none to it, then use this
    <body onload="document.getElementById('DIV NAME HERE').style.display = 'block'; ">
    Code (markup):
    That worked for me.
     
    SEbasic, Dec 21, 2004 IP
  4. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I guess there is always a workaround. ;)
     
    TwisterMc, Dec 21, 2004 IP
  5. MaxM

    MaxM Peon

    Messages:
    183
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    A preloader would be ideal. There's a tutorial on how to construct one at http://www.kirupa.com/developer/mx/preloader.htm
     
    MaxM, Dec 22, 2004 IP
  6. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I have a simple preloader script on my website too. ;)
     
    TwisterMc, Dec 27, 2004 IP
  7. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #7
    OK...

    Sorry to drag this one up again guys, but I'm having some issues with this...

    I need the Flash to delay loading until after the page loads, but I don't have access to the .fla source files.

    The problem with my previous workaround, is that a JS dropdown menu is no longer working.

    I have removed the bit of code that I used above and the dropdown now seems to be working, but the flash is now not there (Because it's set to display:none;)

    This is sooooooooo frustrating...

    Any other workarounds that anyone can think of?

    Help would be greatly appreciated at this point...
     
    SEbasic, Jan 18, 2005 IP
  8. relaxzoolander

    relaxzoolander Peon

    Messages:
    141
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #8
    make another flash movie.
    load the original flash movie into a level of the new flash movie.
    you can control the loading of the first flash movie from the new one.
    use javascript 'onload' to determine when the page is done loading.
    make the new flash movie a javascript object.
    var flashloader=document.flashmov2;
    use javascript to tell the new flash movie to its time to load the original flash movie.

    here is an example of the onload handler triggering an alert after a group of images load:
    http://www.moshbox.com/testing/onload-alert.html
    :)
     
    relaxzoolander, Jan 19, 2005 IP
  9. TwisterMc

    TwisterMc Mac Guru

    Messages:
    972
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I don't think he has the source files.
     
    TwisterMc, Jan 19, 2005 IP
  10. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #10
    No I don't....

    But I managed to find another workaround... (Cheers for all the help though guys...)

    Created a new flash movie, set it to 1fps...

    Made 5 frames, and on the last frame, used this code...

    loadMovieNum("location of SWF", 0);

    It seems to do the trick and it's not too messy...

    Again, thanks guys - wouldn't have done it without all the suggestions.
     
    SEbasic, Jan 19, 2005 IP
  11. relaxzoolander

    relaxzoolander Peon

    Messages:
    141
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #11
    sebasic--------duh!
    did you read my last post?

    plus my solution is more exact since is waits for the actual page load...
    ....instead of just timer based.

    .
     
    relaxzoolander, Jan 19, 2005 IP
  12. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Yeah, I did read the post... (And I did attempt it).

    But I have to confess.

    I am an idiot when it comes to flash and I couldn't get it to work...

    :eek:
     
    SEbasic, Jan 20, 2005 IP
  13. relaxzoolander

    relaxzoolander Peon

    Messages:
    141
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #13
    okee dokee.
    :p
     
    relaxzoolander, Jan 23, 2005 IP
  14. rtheodorow

    rtheodorow Peon

    Messages:
    129
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    You could have also just put the SWF file into an IFRAME....
     
    rtheodorow, Jan 27, 2005 IP
  15. Monmouth Web Developers

    Monmouth Web Developers Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Great site. Hope it helps me and you all. I've tried to solve this problem for a while now. You can use a bunch of these methods described in previous replies, but heres the catch. Any of these methods only guess when the page is loaded. I have not tried the DIV, which may work, but only suspectly. What I mean is that all of these delays, still delay when loading after the onLoad or whatever meathod you use, giving you a whitespace in the browser where the flash movie is supposed to be. I've tried a Flash/HTML embed or object to create the object in html. Then I placed a stop() in the Flash timeline at frame 1. Then, when onLoad triggers, it would call a function to play() the object as in the example below:

    <OBJECT classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
    WIDTH=800 HEIGHT=118 id=yourflash>
    <PARAM NAME=movie VALUE="yourflash.swf">
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=bgcolor VALUE=#FFFFFF>
    <EMBED src="yourflash.swf" name=yourflash swLiveConnect="True" quality=high bgcolor=#FFFFFF WIDTH=800 HEIGHT=118 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/
    index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
    </OBJECT>
    :
    :
    <BODY onload="done()">
    :
    : (javascript)
    function done(){
    var movie = window.document.yourflash;
    movie.Play();
    }

    The only problem with this is that Netscape does not support external Javascript to Flash controls anymore. Why, I don't know. This only works in IE browsers. Maybe they will fix this in the future. :mad:
     
    Monmouth Web Developers, Sep 13, 2005 IP