This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > April 2004 > Test if swf is fully loaded with javascript





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Test if swf is fully loaded with javascript
BronwynL

2004-04-26, 9:28 am

Hi
I've been asked to open a new window for a swf, but not to focus that window
until the swf is fully loaded, ie the new window launches but is not brought to
the front until the swf is ready and waiting.
onLoad() triggers too early - while the macromedia progress bar is showing.

Can anyone give me any ideas?

TIA

BronwynL

jmack007

2004-04-26, 5:32 pm

Hello --

For Flash and JavaScript to communicate successfully you must ensure that your
entire Flash movie has downloaded correctly and all variables in your movie
have been initialized. I suspect this is your problem. onLoad() tries to do its
thing BUT cannot read its correct initialization information and fires
unsuccessfully.

Try sticking this javaScript in the <script> tags on your HTML page which
embeds the flash movie.

if (flashObj().PercentLoaded() == 100) {
your Movie_isReady == "true";
if (yourMovie_isReady == "true") {
// Put the Javascript you want to happen in here...
}
else {
// Put any kind of javascript here that you want to show load progress.
}
}

This is the outline. You can add javascript preloaders or insert "Loading
Section" text that will disappear once the flash movie is determined to be 100%
loaded by the javascript.

--jmac



BronwynL

2004-04-26, 5:32 pm

Hey thanks, jmac. The flashObj(0 is a new one on me - sounds like just what I was looking for.

cheers!
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews