So, I promised SimTouch would be good to go by March 1st and here it is in all it’s ‘beta’ glory. SimTouch is an Adobe Air application that simulates native touch events on the Flash platform. SimTouch is a transparent app that sits on top of the application that you are developing and dispatches TouchEvents to your application through a connection class over sockets. Additionally, by using the SimConnect class you can use your iPhone to simulate Touch Events. Be sure to check out this video for an over view of what SimTouch is and how it functions.
You’ll need to download the SimConnection swc:
That’s all you’ll need to use the iPhone simulator but if you’d like to use the SimTouch Air app you’ll need this:
SimTouch.air (Air 2.0 required)
Currently SimTouch only dispatches TOUCH_BEGIN, TOUCH_MOVE, and TOUCH_END events.
The SimTouch application works by sending data over sockets. You can either send data over up sockets using a custom binary protocol or you can send touch data over tcp sockets using an XML protocol.
Both perform well and I haven’t detected too much improvement using UDP. However UDP is required to use the iPhone connection method.
To use the SimConnect swc with the flex framework, simply download the swc and drop it in you ‘libs’ folder of you new application. To start the connection class simply pass the stage to a new SimConnection class. ex:
<s:WindowedApplication xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/halo”
applicationComplete=”applicationCompleteHandler(event)”
width=”1024″ height=”768″>
<fx:Script>
<![CDATA[
import com.multitouchup.simConnect.SimConnection;
import mx.events.FlexEvent;
protected function applicationCompleteHandler(event:FlexEvent):void
{
var s:SimConnection = new SimConnection(this.stage, 3333, "127.0.0.1", debugCan, false, false);
}
]]>
</fx:Script>
<mx:Canvas id=”debugCan” width=”100%” height=”100%” />
</s:WindowedApplication>
The preceding example shows a the start of the SimConnection class and passes in the stage, port, socket connection location, a debug canvas and sets udp to false and gestures to false.
Gestures
Currently the SimConnection class doesn’t dispatch gestures. I do intend to build out that functionality someday.
Connection to the iPhone
The software that I am currently using to connect to SimConnect is called MSA Remote (iTunes link) by Memo. It uses a custom UDP protocol to send Touch messages. In order to connect to the iPhone one could use the previous code but set the socket location to the location of the current computer on the network and turn UDP to true.
Why is my application all jittery?
You may run into a bug in the Adobe Flex framework where when your application looses focus the framerate is dropped to 1 frame per second. This is a known bug (SDK-25126) and is working correctly as of Flex 4 revision 14001. I suggest going to opensource.adobe.com and pull a more resent version of the Flex SDK where they have this issue fixed. 1
Using the TUIO protocol?
If you are interested in using this application with TouchLib and the TUIO protocol please use the older version of this application. At some point I’ll try to add an additional settings option for the folks that are interested in building apps with this library. If you are using the old SimTouch, remember that you’ll need an additional socket server to connect with.
**Update SimTouch should be started first. Secondly, launch your application and it should connect to SimTouch. The Socket Server needs to be running before the application can connect to it. (Thanks Rodion Bykov!)
**Update 2 To simulate gestures on a mac (not raw touch events) from the iPhone, skip SimConnect and go directly to this blog post “Touch Gestures with Adobe Flex, Adobe Air, and the iPhone” Do not pass go and do not collect 200 doll hairs. The iPhone application that sends gestures is called iTap.

