LOL… we don’t hate you really, just super jealous of your “mad skillz”.
If you find a way to do it without proto can you show us that method as well?
LOL… we don’t hate you really, just super jealous of your “mad skillz”.
If you find a way to do it without proto can you show us that method as well?
without proto you could use hasOwnProperty or isPropertyEnumerable, but these are undocumented and therefore pretty much “unsupported” as well.
MovieClip.prototype.$createEmptyMovieClip = MovieClip.prototype.createEmptyMovieClip;
MovieClip.prototype.createEmptyMovieClip = function(name, depth, init){
var mc = this.$createEmptyMovieClip(name, depth);
for (var prop in init) if (init.isPropertyEnumerable(prop)) mc[prop] = init[prop];
return mc;
}
hmm, otherwise, nothing really comes to mind. The problem comes if you pass a variable that exists in the Object prototype and has the same value. Otherwise you could technically check to see if the value is the same as the value in the Object prototype and then ignore it since you’d know then it was comeing from the prototype and not from the actual object.
Alternatively, you can just be careful enough to use ASSetPropFlags on your Object prototypes, hiding them, so they dont get processed in the for…in loop. However, its possible there may be exceptions where you would want them to be visible in other situations in your coding not including the init object iteration.
… you could also pass in an Object created without the new keyword, though that would require the init definition before the createEmptyMovieClip line and thats just a pain
initObj = Object();
initObj._x = 100;
initObj._y = 200;
this.createEmptyMovieClip(“clip”,1,initObj);
If you ask me, it sounds kind of retarded that those are unsupported. I mean if both methods of it are unsupported, well then why make them?
heh isPropertyEnumerable is color coded but hasOwnProperty isnt :!:
weird.
and mind bogging… :hair:
:: Copyright KIRUPA 2024 //--