# onEnterFrame in a class

**URL:** <https://forum.kirupa.com/t/onenterframe-in-a-class/199883>\
**Category:** flash\
**Created:** [September 7, 2006, 12:39am UTC](https://forum.kirupa.com/t/onenterframe-in-a-class/199883 "2006-09-07T00:39:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![costa](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@costa](https://forum.kirupa.com/u/costa)\
**Post date:** [September 7, 2006, 12:39am UTC](https://forum.kirupa.com/t/onenterframe-in-a-class/199883/1 "2006-09-07T00:39:34Z")

</div>

[COLOR=black][FONT=Arial]Dear All,[/FONT][/COLOR]

I am studying “classes” in order to develop one that allows me to drive a car. After some tries a doubt came out: where to put the controls to drive the car? I mean, where to put the OnEnterFrame handler to refresh the position of the car? In the class or in the main fla?

[COLOR=black][FONT=Arial]I tried this and worked, but I am not sure if this is the best way:[/FONT][/COLOR]

```auto
 
//Main .fla
stop();
var Car:car= new car ();
var onEnterFrame:Function = Update;
function Update(){
         Car.Run();
         }

```

[SIZE=3][FONT=Times New Roman]Is it possible to have the handler in the class?[/FONT][/SIZE]

[SIZE=3][FONT=Times New Roman]Thanks in advance for your help[/FONT][/SIZE]
