Load problem/question

Hello all and thanks for the help. My question:

How do I get a SWF file to load/play AFTER the rest of the page has loaded. The ‘rest of the page’ consists of HTML and images in jpeg and gif format. When I load the page, the flash SWF begins to play immediatly and the graphics on the rest of the page lag behind. On broadband there isn’t a problem, but I need this to load and play on a modem connection AFTER the page loads. The URL I am working on is:

http://65.216.48.82/default2.htm

The page needs to load and THEN the SWF needs to play. Any suggestions guys/gals? Thank you very much. and btw… nice site Kirupa! It’s been VERY helpful to me.

mecc444

THe site looks nice to tell you the truth really well done.
To tell you the truth i really don’t know

Thanks Warlord. Maybe someone out thar can solve this thing.

I would try using javascript to determine if the page is loaded, if it is, it should send a variable to your flash movie, if you want I could give you the code

Seticus, that would rock. I appreciate the help. Send code when you can and any instructions I might need to make it work! Thanks!

mecc444

:slight_smile: here it is, first: the javascript:


<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function checkloaded() {
window.document.myFlash.SetVariable("myVar", "loaded");
}
</script>
</HEAD>
<BODY OnLoad="checkloaded()">

...

<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=366 height=142 **id="myFlash"**>
<embed src="javascript_to_flash.swf" quality=high width=366 height=142
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?
P1_Prod_Version=ShockwaveFlash" 
**name="myFlash" swLiveConnect="true"**>
</embed> 
</object>

...

</BODY>
</HTML>

Now this is how your html-file should look like, make sure your flash-html tag is provided with the things I’ve indicated.

Second: Flash AS, make a new movieclip out of your moviebackground so nobody can see it and give it these actions

[AS]
onClipEvent (enterFrame) {
if (_root.myVar == “loaded”) {
_root.play();
}
}
[/AS]

Your first frame should be completely empty and should have a “stop”-command. Your content should begin on the second frame

That’s all, I didn’t test it so give it a try…

about=javascript
and… the first frame should contain the mc that’s not visible(so it’s not completely empty), but nothing exept that, that’s the only frame where the mc should be

Going to test it in a minute. Thanks a bunch!

Ok, Seticus, your code worked fine but I hit another ‘snag’. It seems that the Flash file is still loading in the background, thus slowing down the page load time. It still takes the same amount of time to load the page only the Flash file isn’t playing. Is there any way I can load the page and then load the Flash file. The file comes in fine on a modem conncection… so I just need it to play… not to load until the rest of the screen is loaded. thanks again for the code! worked perfect… any ideas on the new prob?

I just reread my last post. It’s kind of confusing. Your script worked perfect. BUT, the Flash SWF was loading in the background (i think) because it took forever for the pages HTML and images (gif, jpgs) to load. then the SWF kicked in like it was supposed to. anyway to wait on the SWF load until the page loads? Hope this makes sense.

It does make sense, in that case the easiest way to do it, is to load everything in flash. This is what you should do:

  1. cut the first frame out of your movie (the one with the invisible mc) and make a new flash-file (the same size) paste your frame in there

  2. make a second frame in that movie next to the empty frame, give the frame these actions:

[AS]
loadMovieNum(“yourflash-file.swf”, 2);
[/AS]

“yourflash-file.swf” is your movie, the one you have cutted the first frame out of. the other movie, the blank one should be in your html-tag, that’s the one that should be shown…

It’s not so difficult, but it’s hard to explain, let me know if you don’t understand.

Seticus, you are the man. I got it! Thanks for the help!! Works perfect!
Nice meeting you and nice website. Keep in touch.

If you need my help again, you know where to find me…