This all goes bad once you create the object tag via javascript as well. There are actually 3 javascript methods to replace the vbscript one you can call the method for an object id of fscommand function fscommand::FSCommand(command,args) function fscommand.FSCommand(command,args) the 3rd one is the script tag with the event (this is the only one which can be created before the object is created - from what I have tested)
There is probably another way of using behaviours (.htc files) as well - but as this is cross domain it's not an option. The 3 method based ones I assume only work if you have the <object ...> code in the web page itself. What I was looking for in searching was activex internet explorer and events which is how I found the methods above. Jeff Philip Hutchison wrote: > Shouldn't VBScript be used in place of JavaScript? > > http://www.moock.org/webdesign/flash/fscommand/index.html > http://www.adobe.com/devnet/flash/articles/external_interface_03.html > > This is what Adobe typically uses for FSCommand with Flash: > if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && > navigator.userAgent.indexOf("Windows") != -1 && > navigator.userAgent.indexOf("Windows 3.1") == -1) { > > document.write('<script language=\"VBScript\"\>\n'); > document.write('On Error Resume Next\n'); > document.write('Sub fscommand_FSCommand(ByVal command, ByVal args)\n'); > > document.write(' Call fscommand_DoFSCommand(command, args)\n'); > document.write('End Sub\n'); > document.write('</script\>\n'); > } > > If you're using Conditional Comments, you could refactor the above > code to this: > > <!--[if IE]> > <script language="VBScript"> > On Error Resume Next > Sub fscommand_FSCommand(ByVal command, ByVal args) > Call fscommand_DoFSCommand(command, args) > End Sub > > </script> > <![endif]--> > > > If you want to keep it dynamically-generated using JavaScript, I'd use > Adobe's code with an update to the browser sniffer: > var isMSIE = /*...@cc_on!@*/false; //Dean Edwards' "sniff" > > if (isMSIE) { > document.write('<script language=\"VBScript\"\>\n'); > document.write('On Error Resume Next\n'); > document.write('Sub fscommand_FSCommand(ByVal command, ByVal args)\n'); > > document.write(' Call fscommand_DoFSCommand(command, args)\n'); > document.write('End Sub\n'); > document.write('</script\>\n'); > } > I'd also consider using DOM scripting to replace the document.writes, > but that's another conversation. > > - philip > > > > On Sun, Jan 3, 2010 at 9:11 PM, Jeffrey Borg <[email protected] > <mailto:[email protected]>> wrote: > > This is all fine till you want to create the whole thing dynmically. > > I am in the process of creating an api to embed content into a 3rd > party webpage. Now there appears to be no way of doing this > > <!--[if IE]> > <script type="text/javascript" event="FSCommand(command,args)" > for="myCom"> > myCom_DoFSCommand(command, args); > </script> > <![endif]--> > > > > In ie via javascript and having it actually work. - tried > document.write, tried myCom::FSCommand function, tried > myCom.FSCommand all with the same result it can not find myCom. > > I get complains from ie that it can not find myCom (or whatver I > decide to id the activex object) in the page, even after it's > created it dosen't seem to work. > > My 2nd thought is that if there was a way to do this why isn't it > included into swfobject itself? which is why I think there is no > way of doing it somehow. > > Regards > > Jeffrey > > Aran Rhee wrote: >> Hi Jeffrey. >> >> You can have a look at this test page (from the test suite wiki >> entry). It shows how to call FScommand methods with SWFObject: >> >> http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_dynamic_com.html >> >> There is also a good article by Colin Moock here: >> http://www.moock.org/webdesign/flash/fscommand/index.html >> >> >> Cheers, >> Aran >> >> >> >> >> >> On Fri, Jan 1, 2010 at 11:18 PM, jeffrey <[email protected] >> <mailto:[email protected]>> wrote: >> >> Hi, >> >> Been using swfobject for years not a problem with it. >> >> I have a source webpage which can not be modified and I need >> to embed >> a swf/s which uses fscommand extensively and it would be much >> easier >> to have fscommand working, >> >> I can not use the <script for= event=> method and it dosen't >> appear to >> work if you try injecting it into the page, I have tried the >> idname.FSCommand, idname::FSCommand but they appear exactly >> like the >> vbscript in that it dosen't work the content added later. >> >> I have also tried attachEvent with no luck. >> >> Been searching for quite a few hours and almost thinking that the >> swf's have to be modified to use externalinterface which I >> want to >> avoid, I am no flash developer. >> >> Regards >> >> Jeffrey Borg >> >> -- >> >> You received this message because you are subscribed to the >> Google Groups "SWFObject" group. >> To post to this group, send email to >> [email protected] <mailto:[email protected]>. >> To unsubscribe from this group, send email to >> [email protected] >> <mailto:swfobject%[email protected]>. >> For more options, visit this group at >> http://groups.google.com/group/swfobject?hl=en. >> >> >> >> -- >> >> You received this message because you are subscribed to the >> Google Groups "SWFObject" group. >> To post to this group, send email to [email protected] >> <mailto:[email protected]>. >> To unsubscribe from this group, send email to >> [email protected] >> <mailto:[email protected]>. >> For more options, visit this group at >> http://groups.google.com/group/swfobject?hl=en. > > > -- > Regards > > Jeffrey Borg > Phone: 0466 219 142 > > > > > -- > > You received this message because you are subscribed to the Google > Groups "SWFObject" group. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > To unsubscribe from this group, send email to > [email protected] > <mailto:swfobject%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/swfobject?hl=en. > > > -- > > You received this message because you are subscribed to the Google > Groups "SWFObject" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/swfobject?hl=en. -- Regards Jeffrey Borg Phone: 0466 219 142 -- You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/swfobject?hl=en.
<<attachment: jeffrey.vcf>>
