|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Flash to load last on a web page?
Is it possible to delay the loading of a flash movie without adding frames to the front end of your movie?
The client wants the entire web page to load and then the flash movie to kick off.
__________________
Thanks! |
|
#2
|
||||
|
||||
|
I bet some JavaScript in your html would do the trick. I've seen some scripts by running a search on yahoo.com that allow you to input the preloading order of your images. If you substituted the image for an .swf file and then put it last in line, it would probably get the job done.
Last edited by jmichels : January 12th, 2004 at 06:05 PM. |
|
#3
|
|||
|
|||
|
I'll do a search.. thanks.....
|
|
#4
|
|||
|
|||
|
Did you find anything?
|
|
#5
|
|||
|
|||
|
Yep, you have to put an onload in the body tag and then surround your flash movie with <div> tags:
<body bgcolor="#5A5A5A" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="document.getElementById('image').style.display = 'block'; "> <div id="image"> Your flash code here </div> See it in action here: http://www.suntrust-racing.com/ Good luck, happy to share! |
|
#6
|
|||
|
|||
|
ok but what about when you have the javascript that checks for the flash plugin? Is it different then? I know this method didn't work for me any way I tried with the flash detect....I didn't even try it without it. I know that racing site link you provided has a flash detect AND the flash loading last code. I tried to look at their code and can;t seem to figure out how they set it up. I noticed the on load code within the body tag, but no DIV tags anywhere around the flash code.
|
|
#7
|
|||
|
|||
|
you won't be able to see the div tags when you view source.. just put your <div> tags on either side of your flash tag:
<div id="image"> Your flash code here </div> see the posts above the flash detect code is separate from the "last to load" thing. In the case of the above mentioned site, the flash detect code exists on the same page, if user does not have flash, a jpg goes in it's place... we also have some code (I can't share) that allows the user to see an alternate movie when the user revisits the home page, that's why you may see two flash tags in the code... I really haven't tried viewing the source so I'm not sure if both flash tags show up.... Last edited by needafixx : February 12th, 2004 at 01:40 PM. |
|
#8
|
|||
|
|||
|
Code:
<script language="javascript">
function loadFlash(){
//use document.write() to insert flash object tags now
}
</script>
<body onLoad="loadFlash">
|
|
#9
|
|||
|
|||
|
Here's a more indepth example I used on a project.
Code:
<html>
<head><title>dynamic flash test</title>
<script language="javascript">
<!--//hide
//function to write in flash object when page loads.
function writeFlash(){
//place your flash object tags inside a variable
// i'm gonna split it up a bit here, just for my own purposes of ledgability, and checking for errors... not really necessary.
var flashOut='<OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="550" HEIGHT="100" id="javascripttest" ALIGN="">';
flashOut=flashOut+'<PARAM NAME=movie VALUE="javascripttest.swf">';
flashOut=flashOut+'<PARAM NAME=quality VALUE=high>';
flashOut=flashOut+'<PARAM NAME=bgcolor VALUE=#CC6600>';
flashOut=flashOut+'<EMBED src="javascripttest.swf" quality=high bgcolor=#CC6600 WIDTH="550" HEIGHT="100" NAME="javascripttest" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';
flashOut=flashOut+'</EMBED></OBJECT>';
//create a layer tag to place your flash object into, and to position your flash object
//document.write("<layer name='flashLayer' top=300 left=100>"+flashOut+"</layer>");
//the above didn't seem to work... so i'll try:
//document.write("<layer name='flashLayer'>"+flashOut+"</layer>");
//document.layer.flashLayer.top=500;
//still no go... maybe try it wil div... and style:
document.write("<div name='flashLayer' style='position:absolute; left:100px; top:300px;'>"+flashOut+"</div>");
//this one seems to work in ie... don't know about other browsers, but play around with it and see what you get.
}
//-->
</script>
<body onLoad="writeFlash()">
</body>
</html>
|
|
#10
|
|||
|
|||
|
Hi binkyboo, what does that code do?.... that's okay, you posted while I was posting....
Last edited by needafixx : February 12th, 2004 at 01:47 PM. |
|
#11
|
|||
|
|||
|
It'll load your Flash object last.
|
|
#12
|
|||
|
|||
|
cool you were posting as I was posting... thanks!
|
|
#13
|
|||
|
|||
|
Quote:
Thanks to both of you for responding, and that code seems like it WOULD work, but I can't use a layer. It needs to be in a table. Actually, what's weird is the layout of that racing site is EXACTLY the layout of my site, well pretty close. Last edited by mguerriero : November 30th, 2004 at 12:26 PM. Reason: page deleted |
|
#14
|
|||
|
|||
|
Soooooo basically, I'm being a big pain in the A$$ because I don't want to use a layer, and I want flash detection. Is that too much to ask?????LOL
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Flash to load last on a web page? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|