Draggable

This movie requires Flash Player 9 or above

In between my work and personal projects I have going on at the moment I am trying to work on a particular project which I am quite excited about. I don’t want to reveal too much yet but it should be an exciting addition to my portfolio site when it’s finished. At the moment I am simply in R&D mode, playing and prototyping with different pieces in flash until I can finally bring them all together.

Based on existing code I have ported the ActionScript over from an example and create an ActionScript 3.0 class that I can re-use. I will probably update it later to add even more functionality but for the time being it is doing the trick. I wanted a really smooth way to drag items around on a page but the items had to behave and ‘feel’ like they were actually being dragged. This meant calculating the cursors position in relation to the center of the item and comparing this to it’s previous positions and rotating it accordingly.

At the moment the image gets distorted as it rotates. I’m aware of this occuring when you rotate a bitmap as well as scaling a bitmap to anything other than 100%. If anyone is aware of a way to stop or reduce this then leave me a comment becuase I’d love to figure it out? Perhaps there is a way to use the bitmapData class to apply smoothing to a bitmap? I have just managed to find a handful of blogs which mention the allow smoothing property that you can activate for bitmaps in Flash. There was some great articles on kaourantin.net, valve blog and gskinner. At the moment this flashlet uses a bitmap image from the library so I have enabled allow smoothing directly from the library panel. I will need to do more work on this when I begin loading it the bitmaps dynamically.