SWFObject Incorrect Size

July 11, 2008

I’m using version 1.4 of SWFObject and it seems to be incorrectly sizing certain Flash movies. The JavaScript I’m writing sets the size to 315×180, but the markup it outputs in both Firefox and IE has the size explicitly set to 180×72.

Turns out this was caused by multiple SWFObjects on the same page. The code that wrote them out wasn’t built for multiple objects, so it always created a container div with the same ID, then wrote the object into that div. So the movie wasn’t getting shrunk – it was getting overwritten by a smaller similar-looking one.

Fixed by changing the code to increment a counter of Flash objects so that separate IDs are used each time.

Part of the point of a buglog, I guess, is that you get to keep track of the embarassing ones too =]

Advertisements