Tim's Blog

Digital Ink Using Flex 2

My friend John and I were pounding some beers at our local pub when the topic of Digital Ink arose.  He thought it would be cool to capture a signature via the web using JavaScript.  Of course I then decided to implement the thing in Flex 2.  I got the digital ink working in less than an hour (which is a testament to how bad ass Adobe Flex 2 is).  But I soon realized that I was only half way to capturing signatures via the web.  A screen with a vector graphic signature is cool, but damn near useless.  To complete this task I needed to send the signature somewhere to be archived.  I started searching Google for code to convert a canvas to a bitmap and came across James Ward’s blog.  Rats!!  He had already done what I was trying to do.  I downloaded his source and noticed that my implementation of the digital ink is slightly different.  So I decided to publish my implementation after all.  I totally ripped off his “doSave” method which leverages Tinic Uro’s AS3 PNG Encoder.  That being said I highly recommend visiting his blog.  He goes in to detail on how to use remoting to send the image to the server.  Thanks to the both of them for their help! 

Source

Run Example
Enjoy

Timothy Huertas

PS For once this code is pretty handsome!

Categories: Software Development

There are 10 types of people… » « Random pearls of wisdom mixed with some whining!

2 Comments

  1. Hi Tim,

    I’ve done some effort in that same area.
    I used Open Lazslo, which is a Flex concurrent. I done a stress test (lots and lots of strokes) in both and my application add a better behavior, but yours seams to pick more point at the begin.
    You can check my app at http://www.mainada.net/inputdraw

    The advantage is that it integrates with javascript and directly with forms, so you can pass your drawing thru a form to your server, allowing to save drawing, process then and display them afterwards. which is nice to build drawing related webapps.

    Hope you enjoy it.

  2. Oh yeah.. but it took me much more that just a couple of hours to do 😉

Comments are closed.