# AS3 - accessing MovieClip sprites on frame n?

**URL:** <https://forum.kirupa.com/t/as3-accessing-movieclip-sprites-on-frame-n/203054>\
**Category:** flash\
**Created:** [October 6, 2006, 10:41pm UTC](https://forum.kirupa.com/t/as3-accessing-movieclip-sprites-on-frame-n/203054 "2006-10-06T22:41:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ignitrix](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ignitrix/32/2664_2.png) [@ignitrix](https://forum.kirupa.com/u/ignitrix)\
**Post date:** [October 6, 2006, 10:41pm UTC](https://forum.kirupa.com/t/as3-accessing-movieclip-sprites-on-frame-n/203054/1 "2006-10-06T22:41:50Z")

</div>

I have a MovieClip object on the stage called mcTest with an associated class “TestMC”. mcTest has 5 frames with a different named Sprite on each one of the frames, let’s call them s1, s2, s3, s4, s5.

In the class file for TestMC, I declare:  
public var s1:Sprite;  
…  
public var s5:Sprite;

If I don’t declare them, I, of course, get a “can’t create displayobject” error when I play the movieclip. But when I do declare them, their value is null, even if I do this code in the TestMC constructor:

```auto

public function TestMC()
{
  this.gotoAndPlay(3);
  trace("sc3:"+sc3); // prints: "sc3:null"
}

```

I need to save and store the coordinates (x,y) of sc3 in the constructor, and then removeChild(sc3). Ideas?

Similarly, is it possible to addChild() to a specific frame/key frame rather than addChild to the entire timeline of the MovieClip?

Thanks,  
~JC
