# References

**URL:** <https://forum.kirupa.com/t/references/326533>\
**Category:** Uncategorized\
**Created:** [December 21, 2011, 3:11pm UTC](https://forum.kirupa.com/t/references/326533 "2011-12-21T15:11:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlesg](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@charlesg](https://forum.kirupa.com/u/charlesg)\
**Post date:** [December 21, 2011, 3:11pm UTC](https://forum.kirupa.com/t/references/326533/1 "2011-12-21T15:11:04Z")

</div>

Hi guys,

I’m adding many custom classes on stage using the object.registerclass trick. Those classes all implement the same interface so I can call common functions for all of them. My problem is that I have many of those custom classes for which I keep a reference in the class where I’m attaching them to the stage with attachmovie. So, in this parent class, if I do a for in loop like this:

```auto

for (var key:String in this)
{
   if (this[key] instanceof IMyInterface)
   {
      IMyInterface(this[key]).myFunction();
   }
}

```

it loops through the display reference that I attached, but also through the reference of this attached class that I have in the parent class, so myFunction is called twice. Hope this makes sense…

My question is, is there a way (aside from comparing the key strings in the for in loop) to differentiate a display reference from a class reference?
