Embed flash with swfobject.js using arrays


/ Published in: JavaScript
Save to your folder(s)

Shows how to use an array to embed swf objects with swfobject.js. This allows for multiple embeds (synced ad's etc.)


Copy this code and paste it in your HTML
  1. <!-- load swfobject to load flash -->
  2. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
  3. <script type="text/javascript">
  4. var swfs = [
  5. {
  6. url: 'tbd_msn_hpto_fullpage.swf',
  7. id: 'tbd_msn_hpto_fullpage',
  8. width: 100,
  9. height: 100,
  10. flashvars: {},
  11. params: {
  12. wmode: 'transparent'
  13. },
  14. attributes: {}
  15. }
  16. ];
  17.  
  18. for (var i = 0; i < swfs.length; i++) {
  19. var swf = swfs[i];
  20. swfobject.embedSWF(
  21. swf.url, swf.id, swf.width, swf.height, "9.0.0", false,
  22. swf.flashvars, swf.params, swf.attributes
  23. );
  24. };
  25. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.