# Dynamic Movie Clip Creating Help

**URL:** <https://forum.kirupa.com/t/dynamic-movie-clip-creating-help/304660>\
**Category:** flash\
**Created:** [February 11, 2010, 11:57am UTC](https://forum.kirupa.com/t/dynamic-movie-clip-creating-help/304660 "2010-02-11T11:57:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kainevg](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@Kainevg](https://forum.kirupa.com/u/Kainevg)\
**Post date:** [February 11, 2010, 11:57am UTC](https://forum.kirupa.com/t/dynamic-movie-clip-creating-help/304660/1 "2010-02-11T11:57:24Z")

</div>

Hey guys,

For my game, I need it so when you click a button, a certain movie clip gets created at a certain place… thats been done fine… I need it so if you click on another button AFTER the movie clip has been created it will gotoAndStop();…

This is what i’ve done so far…

```auto
// Class Imports
import com.cfreps.utils.Global;
// Variables
// Event Listener
SpawnRifleMen.addEventListener(MouseEvent.MOUSE_DOWN, SpawnRifleFunc);
AttackButton.addEventListener(MouseEvent.MOUSE_DOWN, AttackFunc);
// Buttons
function SpawnRifleFunc (e:MouseEvent) 
 {
  SpawnCheck = 1
  var RifleGuy:Rifle = new Rifle();
  RifleGuy.x = 100
  RifleGuy.y = 250
  addChild(RifleGuy);
 }
 
function AttackFunc (e:MouseEvent)
 {
  RifleGuy.gotoAndStop(2);
 }
  

```

This just gives me "Access of undefined property “RifleGuy”  
Which is completely understandable seeing as there is no “RifleGuy” until you press the button…

I’ve tried a few things but I really need some help

Thanks in advance - Kaine
