<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:x =
"urn:schemas-microsoft-com:office:excel"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>Chris.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>In the main page, I have this ( I define swfObject first
separately to make sure all functions are available - I think this was the core
of your problem). </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN><SPAN class=843115623-12072006><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2><head><BR><script language="JavaScript"
type="text/javascript" src="swfobject.js"></script><BR><script
language="JavaScript" type="text/javascript"
src="page.js"></script><BR></head></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>The in the page.js file you can do what you wanted (BTW -
you can use single quotes as the outer string in your write/writeln, so you
don't have to escape all the double quotes inside :) </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>document.writeln('<body><div
id="flashContainer"></div>');<BR>document.writeln('<script
type="text/javascript">var so = new SWFObject("test.swf", "test", "425",
"600", "6",
"#ffffff");so.write("flashContainer");<\/script>');</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>Also, looks like you are still using an old version of
FlashObject, in the above example, I am using the newer
SWFObject.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>Cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2>Aran</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=843115623-12072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> swfobject-bounces@lists.deconcept.com
[mailto:swfobject-bounces@lists.deconcept.com] <B>On Behalf Of </B>Chris
Johnson<BR><B>Sent:</B> Wednesday, 12 July 2006 10:10 AM<BR><B>To:</B>
swfobject@lists.deconcept.com<BR><B>Subject:</B> [SWFObject] Race Condition
with Javscript and SWFObject<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hello
there.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I have a page (say, page.js)
called from a script tag as such:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><script
src=”page.js”></script><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Within page.js, I have something
like the following:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">document.write("<html><head><script
type=\"text/javascript\"
src=\"/flashobject.js\"><\/script></head>");<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">document.write("<body><div
id=\"flashContainer\" ></div>");<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">document.write("<script
type=\"text/javascript\">var flashObject=new
FlashObject(\"test.swf\",\"test\",\"425\",\"600\",\"6\",\"#FFFFFF\");flashObject.write(\"flashContainer\");<\/script></body></html>");<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">This works fine in Firefox, but in
IE, 50% of the time, I get a message saying “Error: ‘FlashObject’ is
undefined”. If I add a “defer” attribute to the script tag, I get the
error less frequently. I am pretty sure this is caused by a race
condition. I would like to think that the contents of flashobject.js
will be loaded first, preserving sequence, but this does not appear to be the
case…<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Any suggestions or insights are
appreciated.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Chris<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>