# Help With Functions (easy I think)

**URL:** <https://forum.kirupa.com/t/help-with-functions-easy-i-think/156250>\
**Category:** programming\
**Created:** [July 24, 2005, 9:30am UTC](https://forum.kirupa.com/t/help-with-functions-easy-i-think/156250 "2005-07-24T09:30:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [July 24, 2005, 9:30am UTC](https://forum.kirupa.com/t/help-with-functions-easy-i-think/156250/1 "2005-07-24T09:30:03Z")

</div>

This function business is all new to me but it seems fairly simple. What I have is a player controlled movie clip that moves around with the keys w, s, a and d. I have this code on him which makes it so while the left mouse button is down it preforms the createBullet function.

```auto

onClipEvent(load){
Mouse.addListener(this);
this.onMouseDown = function(){
_root.onEnterFrame = function(){
_root.createBullet();
}
}
this.onMouseUp = function(){
_root.onEnterFrame = null;
}
}

```

This code is on the main time line:

```auto

i = 0;
k = 0;
function createBullet() {
i++;
k++;
if (k == 10) {
k = 0;
}
if (k == 0) {
duplicateMovieClip(_root.bullet, "bullet_"+i, i);
}
}

```

My question is that when I try to add onEnterFrame = function(){} onto the main timeline its is directly affected by the code on the player controlled movieclip (\_root.onEnterFrame = null;). I want to add another function that loops every frame. How would I do this?
