AS3: DisplacementMapFilter for image morphing

Hi guys, it’s been a while…

Recently I have been building an application to manipulate images, and as a part of that I have adapted a class to morph dynamically loaded images.

The problem I am having is that when implementing the displacement class, a small portion of the left side and top of the loaded image get morphed and the image is shifted down and to the right slightly. The original class that I adapted also suffers from the same problem.

I have searched google and various forums for two days in order to better understand [COLOR=blue]DisplacementMapFilter[/COLOR], as well as a part of the class I adapted that uses [COLOR=blue]beginGradientFill[/COLOR] alongside bitwise operators, but I have found nothing that suits my purposes.

I have attached my source.

The original class (that I used as a blueprint) can be found here.

Please help!

(also posted on ActionScript.org)