Code Generator

Would anyone possibly know how I would go about creating a code generator??? so that if I had an image and made it move by dragging it across a picture, the dode for that particular movement would be created?? Basically like making flash. Thanks for any help on the matter

Carad does code generation.

(not sure about animation)