Home > Uncategorized > Merging Flash MX with C#

Merging Flash MX with C#

This is an interesting experiment to merge Flash Mx with a C# back-end. What I was looking to do was to provide a way to collect customer signatures online, and store these for later reference. This has obvious applications for e-commerce and other preventitive means of non-repudation.

To cut to the finished version, please look at http://www.openmerchantaccount.info/research

In order to collect a signature, you need a richer front end than purely HTML, so you can either use Java or Flash. A version of this (non-working unfortunately) has been already been done called Lawrence Goetz http://www.lawrencegoetz.com/programs/signature/, however, in my opinion, Flash is becoming more popular for browser-based applets than Java (also I wanted to learn flash MX).

In order to provide an interface between Flash and a C# backend (asp.net), you can use XMLSockets, or do what I did, which in my opinion, is much easier. Using javascript as an intermediate layer, I used getUrl from flash to communicate with javascript, calling a function that appended XML to a hidden variable in the page. To communicate between javascript and Flash, – in order to implement the clear function, I called the setVariable method on the flash movie. Using a setInterval command within flash to poll on this public variable, I could then act upon a change in the value of this variable, – reloading the movie with _root.loadMovie("signature.swf");

With xml built up within a hidden field, it can then be posted to a backend form, which first corrects any errors in the XML, then parses it in this format

<mousedown><move><x>nnn</x><y>nnn</y></move>…</mousedown>…

The backend page then creates a bitmap object, derives a Graphics object from it, and draws lines using the DrawLine method. The page returns it’s output in Jpeg format.

Again, the whole project is on http://www.openmerchantaccount.info/research

 

 

 

 

 

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: