Closed GoogleCodeExporter closed 9 years ago
SWFObject has a routine for checking for prototype additions inside the
createSWF()
function (which is called internally by embedSWF())
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from
other
potential libraries
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
}
}
It is possible that since the object properties are copied rather than
referenced in
the embedSWF() function, that the prototype you have attached to your object is
coming through as a string value rather than a Object.prototype type.
This will need to be investigated further.
In the mean time, as you are just wanting to copy a simple object which only
holds
single dimension values, you can avoid adding prototype additions and just use
a
shallow clone like:
var newObject= {};
for (var i in oldObject) {
newObject[i] = oldObject[i];
}
Is there any reason you need to clone your flashvars object before passing it
in ?
(as it is cloned for you by SWFOBject anyway)
Original comment by aran.rhee@gmail.com
on 26 Mar 2010 at 12:10
There is no reason to clone the flashvars object, this function is added to
easily
clone any object. It's also easy to work around this issue, but it IS
unexpected
behaviour, and you need to investigate the generated DOM in order to understand
what
goes wrong.
If people use a js library which adds functions to the Object prototype, and
also
want to use SWFObject, it will be hard for them to understand why it doesn't
work,
and since SWFObject exists to make life easier, I thought it was worth
mentioning :)
Original comment by frederik...@gmail.com
on 26 Mar 2010 at 8:47
I understand (hence the issue was not marked as invalid). As I noted already, I
believe
the check in createSWF() is being circumnavigated by the way the flashvars
properties
are being cloned in embedSWF().
Original comment by aran.rhee@gmail.com
on 28 Mar 2010 at 10:18
hi
I also had a 'clone' prototype over the javascript objects.
embedding using swfobject after this declaration causes a bug in IE.
The flashvars are not received correctly in the flash.
Lost 2 days on this issue due to poor IE debug tools. (throw 'anonymous
function error')
Why cant we override standard Object ?
Original comment by julien.b...@gmail.com
on 6 Oct 2010 at 11:20
I was able to replicate the issue in several browsers.
Adding a simple obj.hasOwnProperty(prop) check within embedSWF fixes the
problem.
Original comment by platelu...@gmail.com
on 23 May 2011 at 5:14
Original issue reported on code.google.com by
frederik...@gmail.com
on 25 Mar 2010 at 2:25