Even though it's related to IE and the COM+ bridge, that still doesn't mean that flash couldn't implement js functions that mapped to those COM+ function callbacks. That way we could interact with the callbacks in the same way as other JS functions, which would be a lot more flexible. They do it with their magical __flash_to_XML() functions and such, I don't know why they couldn't do it with all callbacks. Just my 2 cents.
--Kyle From: Philip Hutchison Sent: Wednesday, June 17, 2009 1:44 AM To: [email protected] Subject: Re: 'unknown' type of members in object in IE Hi guys I just encountered "unknown" in IE myself a few weeks ago. It's due to ActionScript/JavaScript communication over the COM+ bridge; IE will not return a proper typeof and will simply say "unknown". It isn't a bug, it's a 'feature' implemented by Microsoft. Quote from comment by Tom Trenka (of dojotoolkit) near the bottom of this blog post: Internet Explorer displays “unknown” when the object in question is on the other side of a COM+ bridge. You may not know this or realize this, but MS’s XMLHTTP object is part of a different COM+ object that implements IUnknown; when you call methods on it, you’re doing so over a COM bridge and not calling native JavaScript. Basically that’s MS’s answer if you try to test or access something that’s not a true part of the JScript engine. Very obscure, indeed. - philip On Tue, Jun 16, 2009 at 7:32 AM, Getify Solutions, Inc. <[email protected]> wrote: Yes, as I said, the "functions" that the flash plugin exposes on a swf object in your DOM are not true JS functions, they are special callbacks handled by the activeX control. There are other things you can normally do with JS functions, that you can't do with them, like use ".call()" or ".apply()" on them. It's frustrating. In fact, I've filed a bug with Adobe a long time ago on a very similar topic, they still haven't addressed it: http://bugs.adobe.com/jira/browse/FP-254 So it's not surprising to me that the typeof() is reporting wrong on those "functions". FWIW, CheckPlayer implements logic that continually tries in a setTimeout loop to call a certain "function" on the swf, with a try/catch, and as soon as it doesn't catch an error, it knows that the function is ready to go. You could try something similar to that. --Kyle -------------------------------------------------- From: "marekful" <[email protected]> Sent: Tuesday, June 16, 2009 9:12 AM To: "SWFObject" <[email protected]> Subject: Re: 'unknown' type of members in object in IE > > Actually it's more than just strange... > > embedSWF works fine, the flash is displayed in all browsers. > Then, in a button's onlick handler: > > var obj = document.getElementById("myFlashObj"); > /* > typeof obj.SetVariable // 'unknown' in IE7, 'function' in FF > obj.SetVariable // null in IE7, 'function SetVariable { [native > code] }' in FF > */ > obj.SetVariable('myvar','myvalue'); // WORKS in IE7 and FF > > > Any thoughts? > > Regards, > //m > > On Jun 16, 2:58 pm, marekful <[email protected]> wrote: >> Hi Kyle, >> >> Yes, I've tested the situation with the traditional way and the same >> happend. >> No, no forms. >> >> The SOLUTION is that there's no need for solution. Earlier, in the >> original context of the problem, SetVariable didn't work for me in IE >> but I've been changing things around it. Now just noticed that even if >> typeof flashObj.SetVariable is 'unknown' and flashObj.SetVariable is >> null in IE just a line before I call it, it will work in IE as well. >> >> Strange.. >> >> Thanks anyway for your responses. >> >> Best Regards, >> //m >> >> On Jun 16, 2:43 pm, "Getify Solutions, Inc." <[email protected]> wrote: >> >> > Yes, you should be able to access the SWF via javascript, regardless of >> > embed method. "SetVariable" is a special type of function that flash >> > registers with the DOM for your SWF. In your description, where it's a >> > click >> > handler, it's unlikely that my idea of timing issues is causing the >> > problem. >> >> > Does this same problem happen to you if you do a normal old-school >> > embed of >> > the SWF? If so, then it's not SWFObject related. If not, then we may >> > have >> > some other things we can try. >> >> > Also, are you embedding the SWF inside a <form> element. I know this >> > causes >> > issues in IE. >> >> > --Kyle >> >> > -------------------------------------------------- >> > From: "marekful" <[email protected]> >> > Sent: Tuesday, June 16, 2009 7:39 AM >> > To: "SWFObject" <[email protected]> >> > Subject: Re: 'unknown' type of members in object in IE >> >> > > Hi Kyle, thanks again. >> >> > > So two things then: >> >> > > 1) Is it meant to be possible in IE to dynamically embed an swf >> > > (using >> > > embedSWF) and then use its SetVariable method to update a variable in >> > > the flash? >> >> > > 2) While the problem in its original context may raise due to >> > > timings, >> > > it's unlikely in the simplified version. There I'm trying to use the >> > > SetVariable function in a button's click event handler way after >> > > everything should be initialised. >> >> > > I've also noticed that the type of the object returned by >> > > document.getElementById is 'object' in IE while it's also 'function' >> > > in other browsers. >> >> > > On Jun 16, 1:25 pm, "Getify Solutions, Inc." <[email protected]> >> > > wrote: >> > >> well, it may be a timing thing. There's a known gap in time between >> > >> when >> > >> the >> > >> swf is embedded on the page and when the external-interface and >> > >> other >> > >> functions are initialized and ready. You probably need to wait until >> > >> at >> > >> least domready, maybe even onload. If that doesn't work, you may >> > >> even >> > >> need >> > >> to wait "longer", sniffing the swf to see when the function is >> > >> ready. >> > >> CheckPlayer (http://checkplayer.flensed.com) is a companion library >> > >> to >> > >> swfobject which provides functionality like this, such as waiting >> > >> for the >> > >> event SWF_EI_READY before trying to call those functions. >> >> > >> --Kyle >> >> > >> -------------------------------------------------- >> > >> From: "marekful" <[email protected]> >> > >> Sent: Tuesday, June 16, 2009 7:13 AM >> > >> To: "SWFObject" <[email protected]> >> > >> Subject: Re: 'unknown' type of members in object in IE >> >> > >> > Hi, thanks for your reply. >> >> > >> > The problem is not accessing the object. (swfobject.getObjectById >> > >> > also >> > >> > seems to return the object event if embedSWF was used.) >> >> > >> > However, even with getting the object using >> > >> > document.getElementById >> > >> > will return the object >> > >> > BUT >> > >> > typeof document.getElementById('myObjID').SetVariable >> > >> > will return 'unknown' in IE (IE7/win) while it returns the >> > >> > expected >> > >> > 'function' in other browsers. >> >> > >> > Any further ideas, please share with me. >> >> > >> > Cheers, >> >> > >> > On Jun 16, 1:08 pm, "Getify Solutions, Inc." <[email protected]> >> > >> > wrote: >> > >> >> swfobject.getObjectById() is only to be used with static >> > >> >> embedding. >> > >> >> You >> > >> >> are >> > >> >> doing dynamic embedding with swfobject.embedSWF(). >> >> > >> >> If you need to access the object by it's id, use a normal DOM >> > >> >> access >> > >> >> method >> > >> >> like "getElementById(...)" or "all[...]", or better yet, use a >> > >> >> framework >> > >> >> like jQuery that abstracts that detail away and access it via >> > >> >> "$('#...')". >> >> > >> >> --Kyle >> >> > >> >> -------------------------------------------------- >> > >> >> From: "marekful" <[email protected]> >> > >> >> Sent: Tuesday, June 16, 2009 5:26 AM >> > >> >> To: "SWFObject" <[email protected]> >> > >> >> Subject: 'unknown' type of members in object in IE >> >> > >> >> > Hi all, >> >> > >> >> > Using SWFObject.embedSWF (either with version 2.1 or 2.2) i >> > >> >> > came >> > >> >> > across the following IE problem: >> >> > >> >> > After successfully embedding the flash content, although the >> > >> >> > SWFObject.getObjectById returns the object in IE and other >> > >> >> > browsers >> > >> >> > members of the returned object are 'unknown' in IE. >> >> > >> >> > Please see the simplified version of the problem belos: >> >> > >> >> > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >> > >> >> > lang="en"> >> >> > >> >> > <head> >> > >> >> > <meta http-equiv="Content-Type" content="text/html; >> > >> >> > charset=utf-8"/> >> > >> >> > <script src="/templates/js/swfobject.2.2.src.js" type="text/ >> > >> >> > javascript"></script> >> > >> >> > </head> >> >> > >> >> > <body> >> > >> >> > <div> >> > >> >> > <div id="playerstat_inner" style="z-index: 100; display: >> > >> >> > block;"></ >> > >> >> > div> >> > >> >> > <script type="text/javascript"> >> > >> >> > var fa = { id: "ratings_chart" }; >> > >> >> > var fv = { xml_file: '/templates/embed/empty_graph_data.txt' }; >> > >> >> > var fp = { allowscriptaccess: 'always', >> > >> >> > allowfullscreen: 'false', >> > >> >> > quality: "medium", >> > >> >> > salign: "t", >> > >> >> > wmode: "opaque" }; >> > >> >> > swfobject.embedSWF('/templates/embed/fcp-line-chart.swf', >> > >> >> > 'playerstat_inner', '623', '420', '6.0.0', '', fv, fp, >> > >> >> > fa); >> >> > >> >> > var testObj = function() { >> > >> >> > a = swfobject.getObjectById('ratings_chart'); >> > >> >> > alert(a?'obj id: '+a.id+' | type of a member: '+typeof >> > >> >> > a.SetVariable:'obj is null'); >> > >> >> > } >> > >> >> > </script> >> > >> >> > <input type="button" value=" Test " onclick="testObj();" /> >> > >> >> > </div> >> > >> >> > </body> >> > >> >> > </html> >> >> > >> >> > I've also tested this in ff3/linux/windows and Safari4/windows >> > >> >> > with >> > >> >> > success. >> >> > >> >> > Please share any ideas, >> > >> >> > Cheers > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
