hiimnalaa / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Can only pass a selector to embedSWF #533

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently only an id can be passed to embedSWF. It would be better if you could 
pass a element instead i.e. an object. It would make it more friendly to js 
libraries and iframes.

swfobject 2.2 - winXP

An example solution could be: 

/* Cross-browser dynamic SWF creation */
function createSWF(attObj, parObj, id) {
var r,el = (typeof id == 'string') ? document.getElementById(id) : id;
/* etc etc*/

It raises the question of noobs passing all sorts to swfobject inc classes but 
maybe be explicit in the docs??

Original issue reported on code.google.com by simondon...@gmail.com on 31 Jan 2011 at 6:06

GoogleCodeExporter commented 9 years ago
i agree and have this on the radar. no promises though

Original comment by platelu...@gmail.com on 31 Jan 2011 at 9:07

GoogleCodeExporter commented 9 years ago
Ok cool, let me know if I can help out!

Thanks ,Simon

Original comment by simondon...@gmail.com on 2 Feb 2011 at 6:13

GoogleCodeExporter commented 9 years ago
+1, let me know if I can help.  I just glanced at src/swfobject.js code and it 
seems like the change would be relatively global (you're passing around Strings 
vs. HTMLElements quite a bit).

I'd also like to see this happen, as having to create semi-unique IDs with +new 
Date (a millisecond time stamp) to try to ensure uniqueness as well as querying 
the DOM every time you start each function is slightly wasteful (I know not 
much, but a little bit).

Original comment by dsb...@gmail.com on 5 Apr 2011 at 3:21

GoogleCodeExporter commented 9 years ago
Added ability to pass element reference in place of selector for embedSWF, 
createSWF and removeSWF functions. The main edit was in the getElementById 
'helper' function, which means any function in the SWFObject library that uses 
getElementById will be able to accept a selector OR an element reference, 
including setVisibility and others.

Tested in:
Mac OS X: Chrome 11, Safari 5, Firefox 4, Opera 11
Win7: Firefox 3.6, IE9
WinXP: Firefox 3, IE7

Original comment by platelu...@gmail.com on 23 May 2011 at 1:27