Hello,
I have been struggling all morning so far...I have to create links that open a new window and load a .swf. I am using document.write to create the popup and load all the code for the .swf.
That works fine. But then I try to write a function and the whole thing dies.
So it is this part that kills everything...
If I cut those then it works. The problem is that I need to pass some variables over to the .swf based on the link clicked and so I need the function to be on the page to trigger.
"Credit belongs to the man who is actually in the arena - T.Roosevelt
I have been struggling all morning so far...I have to create links that open a new window and load a .swf. I am using document.write to create the popup and load all the code for the .swf.
That works fine. But then I try to write a function and the whole thing dies.
Code:
function openSWF(){
var toolWindow=window.open('','name','toolbar=no,location=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=500,height=350');
toolWindow.document.write('<!DOCTYPE html PUBLIC "-
//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-[/URL]
transitional.dtd">')
toolWindow.document.write('<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL]
xml:lang="en" lang="en"> ');
toolWindow.document.write('<head><title>ToolsBox</title>');
toolWindow.document.write("<script src='../../../Scripts/AC_RunActiveContent.js'
type='text/javascript'></script>");
toolWindow.document.write('</head>');
toolWindow.document.write('<body>');
toolWindow.document.write("<script language='JavaScript' type='text/javascript'>")
toolWindow.document.write('<!-- ')
toolWindow.document.write (" function setVariable()
{thisMovie(pasVar.swf).SetVariable ('text.Var.text',
Hello);}")
toolWindow.document.write (' -->')
toolWindow.document.write ('</script>')
toolWindow.document.write("<p>Here's the page, did it work?</p>");
toolWindow.document.write('<div align="center">')
toolWindow.document.write("<script type='text/javascript'> ")
toolWindow.document.write("AC_FL_RunContent('codebase','[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/[/URL]
/flash/swflash.cab#version=7,0,19,0','width','400','height',
'250','title','testmovie','src','passVar','quality','high',
'pluginspage','[URL unfurl="true"]http://www.macromedia.com/go/getflashplayer',[/URL]
'swLiveConnect','true','movie','passVar' );")
toolWindow.document.write(' //end AC code ')
toolWindow.document.write('</script> <noscript>')
toolWindow.document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ')
toolWindow.document.write ('codebase="[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/[/URL]
cabs/flash/swflash.cab#version=7,0,19,0" width="400" height="250"
title="testmovie">')
toolWindow.document.write('<param name="movie" value="passVar.swf" />')
toolWindow.document.write('<param name="quality" value="high" />')
toolWindow.document.write('<embed src="passVar.swf" quality="high" pluginspage="[URL unfurl="true"]http://www.macromedia.com/go/getflashplayer"[/URL]
type="application/x-shockwave-flash"
width="400" height="250"')
toolWindow.document.write ('swLiveConnect = "true">')
toolWindow.document.write ('</embed>')
toolWindow.document.write('</object></noscript><hr />')
toolWindow.document.write('</div>')
toolWindow.document.write('<div align="right"><a href="javascript:self.close()">Close</a> the popup.</div>')
toolWindow.document.write ('</body></html>');
toolWindow.document.close();
}
So it is this part that kills everything...
Code:
toolWindow.document.write('<!-- ')
toolWindow.document.write (" function setVariable() {thisMovie(pasVar.swf).SetVariable ('text.Var.text', Hello);}")
toolWindow.document.write (' -->')
If I cut those then it works. The problem is that I need to pass some variables over to the .swf based on the link clicked and so I need the function to be on the page to trigger.
"Credit belongs to the man who is actually in the arena - T.Roosevelt