# Next frame?

**URL:** https://forum.kirupa.com/t/next-frame/303395
**Category:** flash
**Created:** [January 19, 2010, 7:22pm UTC](https://forum.kirupa.com/t/next-frame/303395 "2010-01-19T19:22:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Luigi\_Vercotti](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Luigi\_Vercotti](https://forum.kirupa.com/u/Luigi_Vercotti)
#### Post date: [January 19, 2010, 7:22pm UTC](https://forum.kirupa.com/t/next-frame/303395/1 "2010-01-19T19:22:45Z")

</div>

I’ve got the code for circle on an image (mask).  
I’ve got it in my first frame and I need do something else in 2nd frame but after the movie in 1st frame is finished.  
Can you help me please?

```auto
//This container contains all the circles that act as a mask for the picture
var container:Sprite = new Sprite();
 
//Assign the container to be the image's mask
picture.mask = container;
 
//Add the container to the stage
addChild (container);
 
/*
This timer is responsible for creating a circle every 0.05 seconds.
A total of 20 circles will be created.
*/
var timer = new Timer(50,20);
timer.addEventListener (TimerEvent.TIMER, createMaskBall);
timer.start ();
 
//The timer calls this function every 0.05 seconds
function createMaskBall (e:Event):void {
 
    //Create a new MaskBall
    var maskBall:MaskBall = new MaskBall();
 
    //Set scale to zero so it won't be visible at the beginning
    maskBall.scaleX = 0;
    maskBall.scaleY = 0;
 
    //Assign a random position in the stage
    maskBall.x = Math.random() * stage.stageWidth;
    maskBall.y = Math.random() * stage.stageHeight;
 
    //Add the maskBall to the container
    container.addChild (maskBall);
 
    //We need ENTER_FRAME function to handle the animation
    maskBall.addEventListener (Event.ENTER_FRAME, animateMaskBall);
}
 
//This function is called in every frame
function animateMaskBall (e:Event):void {
 
    //Increase the scale
    e.target.scaleX += 0.05;
    e.target.scaleY += 0.05;
}

```
