开发者

Question about embedding Flash: swfObject vs < Object >

开发者 https://www.devze.com 2023-01-28 13:43 出处:网络
I noticed that the Flash CS5 IDE publishes a very lean html code (see below) which appears to utilise the < object > tag. 开发者_StackOverflow中文版This seems to work very well - although I have th

I noticed that the Flash CS5 IDE publishes a very lean html code (see below) which appears to utilise the < object > tag. 开发者_StackOverflow中文版This seems to work very well - although I have this nagging feeling that I should be using swfObject .. how is swfObject different to the < object > tag? I've tested the code on all the browsers (IE6 included) with no problems.

Is it time to ditch swfObject? Or are there features I'm overlooking?

If swfObject is the "standard" why doesn't the latest Flash IDE utilise it?

<object id='mySWF' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='100%' height='100%'>
   <param name='movie' value='index.swf'>
   <param name='allowfullscreen' value='true'>
   <param name='bgcolor' value='#919191'>
   <!--[if !IE]>-->
   <object type='application/x-shockwave-flash' data='index.swf' width='100%' height='100%'>
   <param name='allowfullscreen' value='true'>
   <param name='bgcolor' value='#919191'>
   <!--<![endif]-->
   <a href="http://www.adobe.com/go/getflashplayer">Get Flash</a>
   <!--[if !IE]>-->
   </object>
   <!--<![endif]-->
</object>


swfObject isn't necessarily a "standard" as you put it. It's a third party javascript library that allows you to easily progressively enhance your website with flash. swfObject was not created by adobe, so whether the IDE supports it is completely at their discretion.

You may want to use swfObject in place of an object tag if you plan on supporting multiple incompatible versions of flash with different swfs or if you want your website to be able to gracefully degrade in functionality. If you place an object tag in your html you're committing yourself to exposing that flash content, and if a user doesn't have the correct version of flash they'll get bumpkis aside from the link to "Get Flash." On the other hand, depending on what your goals are in your use of flash, a static or animated image may suffice in place of the flash content. swfObject allows you to easily accomplish those goals.


JCraine: The code you posted is SWFObject! :)

SWFObject has two variations: one is pure JavaScript, the other is static markup (which is what you posted). When using static markup, the SWFObject JavaScript library provides additional functionality, such as version detection and the getObjectById method.

You can read more about it here: http://learnswfobject.com/the-basics/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号