So as promised in my previous post I am going to release the sourcecode of the MTRuler application with some documentation . So basically this application consists of  3 classes.


The class MTButton has been used before in NUIPad v0.1 .For the documentation of that you can refer here.In this application only the button "Calibrate 6Inch" uses this class.

The class Utils uses some static functions like rounding up,setting and getting the ppi,getting in cm scale given in pixels,getting in inch scale given in pixels etc.Also it has methods to set up in

The Cross class is a sprite which is added wherever we touch with a textbox to show the coordinates of the touching points. Also it has got a public method clear() which clears the graphics of all the components.This class takes input as x,y,width,height. That is where the blob position located and what will be the height and width of the cross heirs (which i always take as 3screnwidth and 3 screen height so that it covers whole screen when moved.).

Then comes the main class . Initially in the constructor all the components are added and also an event listener is added which executes the event handler with each frame being passed . The event handler function is update(e:Event) which checks the current blobs on the surface and then if there are two blobs then calculates the distance in different units and shows up in the resultbox. The resultbox is a component which is basically made up of RotatableScalable class.Also there is a variable called isCalibrating which is set in case of doing calibration. In the update function it checks if isCalibrating is set then it executes for calibrating or else it does the calculation . Also there is a function called doCalibration() which acts as event handler to the touchevent of the MTButton present.

So this is it for now . Anything else you want to know please ask me. Thanks . The sourcecode is attached at the top of this. Again I thank Christian Moore for his guidance in the making of this application.