Annoying handling of function pointers in AS3

I’m not sure if you’ve noticed this, probably not, but function pointers in AS3 run much, much slower than calling the function directly.

It’s a recent finding, and an annoying one. I use function pointers a lot.

An obvious example would be to easily change the behaviour of a certain object.

Say I have a class that controls movement, it has a class level function variable called UPDATE (ie public var UPDATE:Function), and 3 or 4 actual functions it can point to.

This always me to quickly/easily change the behaviour of an object. Say for example I want an object to run on different movement code once it’s collided with something, I can just do UPDATE = movement2; etc.

However, a pointer for a function runs about 15 times slower than running the function directly, therefore I need a replacement.

And I really have no idea why there is this absurd disparity in speed between the 2. With some variables, accessing a reference is faster than accessing the variable directly, obviously not with functions.

What would you advise as a nice, simple replacement solution for the above example?

Cheers,
RumbleSushi