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
-~----------~----~----~----~------~----~------~--~---

Reply via email to