# Object literals

**URL:** <https://forum.kirupa.com/t/object-literals/16123>\
**Category:** Uncategorized\
**Created:** [March 21, 2003, 3:51am UTC](https://forum.kirupa.com/t/object-literals/16123 "2003-03-21T03:51:31Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 5:09pm UTC](https://forum.kirupa.com/t/object-literals/16123/21 "2003-03-23T17:09:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 10:46pm UTC](https://forum.kirupa.com/t/object-literals/16123/22 "2003-03-23T22:46:37Z")

</div>

without **proto** you could use hasOwnProperty or isPropertyEnumerable, but these are undocumented and therefore pretty much “unsupported” as well.

```auto

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);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 10:58pm UTC](https://forum.kirupa.com/t/object-literals/16123/23 "2003-03-23T22:58:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:03pm UTC](https://forum.kirupa.com/t/object-literals/16123/24 "2003-03-23T23:03:58Z")

</div>

heh isPropertyEnumerable is color coded but hasOwnProperty isnt :!:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:05pm UTC](https://forum.kirupa.com/t/object-literals/16123/25 "2003-03-23T23:05:57Z")

</div>

weird.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 24, 2003, 11:28am UTC](https://forum.kirupa.com/t/object-literals/16123/26 "2003-03-24T11:28:52Z")

</div>

and mind bogging… :hair:

[Previous page](https://forum.kirupa.com/t/object-literals/16123.md?page=1)
