# Beginner onEnterFrame questions

**URL:** <https://forum.kirupa.com/t/beginner-onenterframe-questions/279374>\
**Category:** Uncategorized\
**Created:** [January 14, 2009, 2:28am UTC](https://forum.kirupa.com/t/beginner-onenterframe-questions/279374 "2009-01-14T02:28:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonoda](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jasonoda](https://forum.kirupa.com/u/jasonoda)\
**Post date:** [January 14, 2009, 2:28am UTC](https://forum.kirupa.com/t/beginner-onenterframe-questions/279374/1 "2009-01-14T02:28:12Z")

</div>

I have to learn as3, but don’t plan on sticking with it past this one particular job where I am being forced to use it. I just need to know how to do a couple simple things to get around. I just want to write my code in the timeline for simplicity. I have no interest in messing around with classes.

In as2 I would write into the timeline of a movieclip representing a bad guy in a videogame somthing like:

onEnterFrame=function(){  
\_root.badguy(this)  
}

then on the \_root:

function badguy(name){  
name.\_x+=10  
}

I know how to do this:

addEventListener(Event.ENTER\_FRAME, badguy);  
function badguy(ev:Event) {  
badguy1.x+=2;  
}

but this is not helpful in most situations. I want to write it the way I did before. How do I do this?

also, how do I reference the \_root?  
i tried going into the badguy movie clip and adding a listener and then writing \_parent.badguy() for the function to call, but that failed to work.
