best way to implement this wait functionality

P

phil.swenson

I have this function that returns an instance to a flash widget:

function getFlashInstance() {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[FLASH_MOVIE_NAME]
}
else {
return document[FLASH_MOVIE_NAME];
}
}

The problem is if my flash widget isn't loaded yet I get an undefined
object...

I have a function that gets called when the flash object is registered
(lineChartLoaded()). What I want is for the getFlashInstance to "wait"
until the lineChartLoaded function is called and then return the
object.

Also note that I really can't just trigger this whole thing off the
lineChartLoaded() function because there is server side state I'm
waiting on too.

Any suggestions?
 
R

Randy Webb

(e-mail address removed) said the following on 11/2/2006 11:28 AM:
I have this function that returns an instance to a flash widget:

function getFlashInstance() {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[FLASH_MOVIE_NAME]
}
else {
return document[FLASH_MOVIE_NAME];
}
}

The problem is if my flash widget isn't loaded yet I get an undefined
object...

I have a function that gets called when the flash object is registered
(lineChartLoaded()). What I want is for the getFlashInstance to "wait"
until the lineChartLoaded function is called and then return the
object.

Also note that I really can't just trigger this whole thing off the
lineChartLoaded() function because there is server side state I'm
waiting on too.

Any suggestions?

window.onload = someFunction;

And someFunction starts the whole process. The only way to know for sure
that an object is loaded is either the onload of the object or the
onload of the window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top