Last question before i turn in for the night
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 (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: Ty[e 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!