# \[Q\] retrieve a value from a Class

**URL:** <https://forum.kirupa.com/t/q-retrieve-a-value-from-a-class/233714>\
**Category:** flash\
**Created:** [July 26, 2007, 10:33am UTC](https://forum.kirupa.com/t/q-retrieve-a-value-from-a-class/233714 "2007-07-26T10:33:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![manfree](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@manfree](https://forum.kirupa.com/u/manfree)\
**Post date:** [July 26, 2007, 10:33am UTC](https://forum.kirupa.com/t/q-retrieve-a-value-from-a-class/233714/1 "2007-07-26T10:33:32Z")

</div>

dear all

i have create a simple class ABC

```auto
package {
   class ABC extends MovieClip {
      private var _id:Number;
      public function ABC() {
         this._id = 0;
      }
      public function setID(in_id:Number):void {
         this._id = in_id;
      }
      public function getID():Number {
         return this._id;
      }
   }
}

```

and a loop for assigning the ID

```auto
for (var i=0; i<10; i++) {
   var a:ABC = new ABC();
   a.name = "a" + i;
   a.setID(i);
   addChild(a);
}

```

what is the syntax, if i would like to retrieve the 3rd ID (that is MovieClip “a2”)  
a2.getID(); // seems not working  
MovieClip(root).a2.getID(); // not working as well

THANKS ~~
