tags:

views:

22

answers:

1

Here's my explanation of the question:

From JavaScript, you need to get a reference to the Flash Player object. There are two basic Flash Player versions that run in the browser: ActiveX and the plug-in version. The ActiveX version runs natively in Internet Explorer, while the plug-in version is used by the rest of the browsers.

The ActiveX player is controlled by the object tag in an HTML page, and you can retrieve a JavaScript reference using window. objectId where objectId is the value of the id attribute of the object tag. For example, if the object tag's id attribute is example, then the reference to the ActiveX player would be window.example.

The plug-in player is controlled by the embed tag in an HTML page, and you can retrieve a JavaScript reference by using window.document. embedName, where embedName is the value of the name attribute of the embed tag. For example, if the embed tag's name attribute is example, then the reference to the plug-in player would be window.document.example.

And here's the question itself:

Why does the Flash Player Object exist as a window property when embeded via the object tag, while, when embeded via the embed tag, it exists in the window.document property? And what is the most modern way of getting the Flash Player Object from within a web page?

A: 

The answer is embedded in the question itself. IE uses object tags and hence SWF is a window object when embedded with object tags. Rest of the world uses embed tags and hence SWF is a property of the window.document for them.

Amarghosh
Excuse me, but it doesn't simply work in my IE 6 when I try to get the object like so: var o = window.flashId; But when I get the object like so: var o = window[flashId]; or like so: var o = document[flashId]; - it works in my IE 6. So, how on earth do people get the object??? How to do it right?
WeWillFlashYou