Monday, April 28, 2008

Flash to Javascript calls in Internet Explorer

I was having trouble getting a Flash that uses "FSCommand()" to send messages to javascript on a page working in Internet Explorer 7 (this applies to other versions too I'm assumming).  Worked fine in Firefox just having the

function flashEmbedID_DoFSCommand(command, args) {}

javascript function defined somewhere in the page.  But the same setup in Internet Explorer seemed to not be getting any calls from the Flash.

Internet Explorer runs Flash as an ActiveX component instead of a plug-in like Firefox does.  I had already read somewhere that you need to use VBScript to get a call from Flash in IE, and then make a subsequent call to javascript.

I tried this right away, but still no go. After days of sandbox testing and googling one thing after another, I somehow came up with just the right mix of words to feed Google and came back with a possible fix (NOTE: I'm using the latest version of SWFObject 2 for javascript-based standards compliant Flash embedding, which is similar to UFO and actually replaces it (along with SWFObject 1.5, which was not so similar to UFO)). Follow the rabbit trail:


Q Why doesn't fscommand work in Internet Explorer?
A In order to make fscommand work in Internet Explorer Adobe recommends to add a block of VBScript to capture and forward the FSCommand calls to JavaScript. However VBScript doesn't work anymore when a Flash movie is inserted using innerHTML, like UFO does. Fortunately you can also use JavaScript instead of VBScript to catch the FSCommand calls. A small downside is that it uses proprietary attributes, however wrapped in conditional comments you will keep your code valid. A sample page can be found here.

I'm not sure his explanation exactly fits my problem, since I tried not using SWFObject, just using a straight <object> embed, and it still did not work in IE.  I'm guessing ASP.NET or something else broke the VBScript FSCommand subroutine calls working for me, so using the javascript with the proprietary "event" and "for" attributes was still a great solution.

Friday, April 04, 2008

Netflix Site Design Upgrades

So, Netflix has done a complete revamping of their site design - bringing some of the changes they made to the "New Releases" page to the rest of the site.

Having dabbled primarily in web application development now for awhile, the first thing that I noticed was that they changed the width of the overall layout.  Previously, the site had a fixed layout fit perfectly well into any 800px wide display - catering to people still stuck using 800x600 as their screen resolution.  This is something you used to see pushed a lot on the net.  Making sure their your pages still look ok on older computers - or for yesteryears abundance of novices who hadn't even seen their Display control panel since they had installed Windows 98 years prior.

The new Netflix site design is still a fixed layout, but now looks best on a 1024px wide or wider display.  Anything less, and you will get horizontal scroll bars.  "So What? They have an extra 224 pixels of width to take up now -- big deal!"  Well, I can tell you from experience, having worked on two large projects recently where one was designed to support 800x600 displays and the other only 1024x768 and above, that it is much easier to obtain a 'Web 2.0-ish' look when you have those extra pixels to play with.  I am glad to see that high visibility sites like this are committing to a new, higher standard.

Disqus for A Nofsinger's Blog