# Accessing animation of nested symbols using AS3 in Flash CS4

**URL:** https://forum.kirupa.com/t/accessing-animation-of-nested-symbols-using-as3-in-flash-cs4/634088
**Category:** flash
**Created:** [December 28, 2015, 8:01am UTC](https://forum.kirupa.com/t/accessing-animation-of-nested-symbols-using-as3-in-flash-cs4/634088 "2015-12-28T08:01:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ImFromTheFuture](https://avatars.discourse-cdn.com/v4/letter/i/6a8cbe/32.png) [@ImFromTheFuture](https://forum.kirupa.com/u/ImFromTheFuture)
#### Post date: [December 28, 2015, 8:01am UTC](https://forum.kirupa.com/t/accessing-animation-of-nested-symbols-using-as3-in-flash-cs4/634088/1 "2015-12-28T08:01:36Z")

</div>

I am making a Zombie shoot-em-up game. I created a Zombi symbol with the default Zombie sprite. Inside the symbol I placed three more sprites that are ZombiAttack, ZombiIdle, and ZombiMove, in the frames 1, 15 and 20 respectively. I further converted the sprites to symbols and inside their respective symbols I placed the remaining sprites. So it’s like this:

- Zombi (Main Symbol):

1. ZombiAttack (in Frame 1): inside this I placed the remaining Zombie Attack sprites placed at intervals of 5 frames.

2. ZombiIdle (in Frame 15): inside this I placed the remaining Zombie Idle sprites placed at intervals of 5 frames.

3. ZombiMove (in Frame 20): inside this I placed the remaining Zombie Move sprites placed at intervals of 5 frames.

In the Zombi Class File I used the following code in the ENTER\_FRAME listener’s function:

```
this.gotoAndPlay(20); //For the moving animation of the Zombie.

```

This plays a static image of the frame 20 and not what’s inside it (which I want it to play).

Now, my question is how do I do that? How do I play the nested symbols animation and control it further?

I am calculating the distance of the Zombie sprite from the player and if it is above the limit, I want the “ZombiMove” animation to play else it should play the attack animation “ZombiAttack”.

I’ve found a few posts that address a similar problem but the solution for them isn’t working for me as many posts were dated back to 2004 and 2005 and deal with AS2. (I don’t know AS2)

Also, I am creating all the movie clips during runtime using AS3. The Zombie sprites as well are generated randomly outside of the screen and then proceed towards the player.

Thanks in advance! 🙂
