# Ease animation function - evil event listeners

**URL:** <https://forum.kirupa.com/t/ease-animation-function-evil-event-listeners/243183>\
**Category:** Uncategorized\
**Created:** [November 3, 2007, 11:35pm UTC](https://forum.kirupa.com/t/ease-animation-function-evil-event-listeners/243183 "2007-11-03T23:35:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingscooty](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@kingscooty](https://forum.kirupa.com/u/kingscooty)\
**Post date:** [November 3, 2007, 11:35pm UTC](https://forum.kirupa.com/t/ease-animation-function-evil-event-listeners/243183/1 "2007-11-03T23:35:24Z")

</div>

Last question before i turn in for the night :stare:

I’ve been working on a node class, which places a circle on the stage and holds information about it, such as ID and coordinates etc.

I’ve been working on an ease animation function for the class, so i can animate each node to a certain y location on the stage with a nice slow down as it reaches its target destination (sadly, i’m not sure how to apply this for BOTH x and y).

I have no idea how the ENTER\_FRAME event listeners work, so this was my longshot attempt:

[AS]  
public function easeNode($destination:Point)  
{  
var previousPosition:Point = new Point(node.x,node.y);  
var speed:int = randRange(4,12);

```
        node.addEventListener(Event.ENTER_FRAME, animation);
        
        function animation (e:Event):void {     
    
            node.y += ($destination.y - node.y)/speed;
            if( node.y == previousPosition.y) {
                node.y = $destination.y;
                animation.removeEventListener(Event.ENTER_FRAME, animation);
            }
            previousPosition.y = node.y;
        }
    }

```

[/AS]

Useage:

[AS]  
nodes[2].easeNode(new Point(43,34));  
[/AS]

I’m getting this error at compile:

> 

Description:  
1046: Type was not found or was not a compile-time constant: Event.

Source:  
function animation (e:Event):void {

Can one of you AS3 gurus out there set me straight and point out my errors? 🙂

Thanks again guys, you’re the best! 🙂
