Little progress update
Sorry for the lack of updates but I managed to get some work done over the last few weeks and I am happy to tell you that the latest svn revision already contains most of the stuff I planned implementing for the next release. Especially the new event model!
I'll do a release somewhere around the first week of February and I will also publish another article in the Guides section on how to use the new event model.
So stay tuned and if you can't wait just use the current svn release. It should be pretty stable but there will be some naming changes for classes and events until the final release.
P.S. I am also working on some kind of feature roadmap for the upcoming releases until 1.0 and would like some input on what you'd like to see in the near future?
January 22nd, 2010 - 11:59
Thanks for the updates. For you guys trying to get the new version to work try to initialize the manager like this:
// initalization of TuioManager
tuioClient = new TuioClient(new LCConnector());
tuioManager = new TuioManager(stage, tuioClient);
Add Eventlisteners for the type of contacts you want to process. In my example I only need cursors. So I added the following event listeners to the TuioManager instance:
tuioManager.addEventListener(TuioEvent.ADD_CURSOR, onAddTuioCursor);
tuioManager.addEventListener(TuioEvent.UPDATE_CURSOR, onUpdateTuioCursor);
tuioManager.addEventListener(TuioEvent.REMOVE_CURSOR, onRemoveTuioCursor);
In the callback function you will get the event (instead of the cursor in the previous version when implementing the interface directly) and need to fetch the Tuio object from the tuioContainer:
public function onAddTuioCursor(tuioEvent:TuioEvent):void
{
// get the cursor
var tuioCursor:TuioCursor = tuioEvent.tuioContainer as TuioCursor;
}
HTH, Patrick
PS: I am in a struggle getting this new version to work with papervision3d to make 3d objects clickable using the new TouchEvents. I appreciate any suggestion on this topic.
January 22nd, 2010 - 20:55
Hi, thx for posting the little guide
What is your problem with the new TouchEvent and papervision? Basically the touch event should be dispatched on the top DisplayObject in the display list, though I’ll probably change that to InteractiveOjects in the near future.
Maybe you could send me some example.
January 23rd, 2010 - 22:16
The problem was to get the target at the touch position. The code in the TouiManager
var targets:Array = stage.getObjectsUnderPoint(stagePos);
just returned an object of the type
org.papervision3d.view.layer.ViewportBaseLayer
In the meantime I found a solution by generating custom ViewportLayers for each object. These layers have a method getLayerObjects() to fetch the object itself. So I can currently add TouchEvent Listeners to the layer objects
But I have recognized another problem in the TuioManager. In my application I draw visual feedback (circle) for each curso at the cursors position. So, if I am correct, there will be always another object on top of the object a user want to manipulate in the application. This will happen every time you draw something at the cursor position and want to manipulate the underlying object.
I had to change the lines 54 and 69 of TuioManager.as to:
var target:DisplayObject = (targets.length > 0) ? targets[targets.length-2] : stage;
and get the target at the position “targets.length-2″ to get access to the applications object. IMO this part should be somehow configurable.
The handleRemove method works with the “targets.length-1″ cause there is nothing to be drawn if the contact has been removed
It is really fun playing around with the TouchEvents in a 3D environment and I really appreciate your work.
Thanks and regards
Patrick
January 24th, 2010 - 18:09
Glad you like the library
The problem with the touchfeedback circles is already known. This happens because as you already said those circles will always be on top of all the other DisplayObjects. My current solution is to just draw the outline of the touch circle which works pretty well.
A more general solution will be available when I’ve finished using only InteractiveObjects from the getObjectsUnderPoint() list since they have a property that states whether they are mouseEnabled or not which I will handle in the same way for dispatching TouchEvents.
But some kind of DisplayObject ignore list could be a good solution too.
January 28th, 2010 - 15:39
Hi there,
I’ve tested the ignorelist and found the following bug at line187 in the removeFromIgnoreList() function:
listItem = ignoreList.pop();
has to be
listItem = ignoreListCopy.pop();
And I think the ignorelist has to locked somehow, so the functions addToIgnoreList() and removeFromIgnoreList() do not interfere.
Patrick
January 28th, 2010 - 19:58
Since there is no threading in as3 locking won’t be necessary
Thanks for the bugreport, I’ll have a look at it.
edit: corrected but I removed the whole copied list part since it wasn’t needed anyway.
February 1st, 2010 - 13:36
I see, I am new to the whole as3 thing.
Have a look at line 139 of TuioManger.as, some left comment parts produce an error over there
February 1st, 2010 - 20:49
xD I wonder how that happened, should be corrected now.
February 9th, 2010 - 01:16
Looking great!
Any plans to implement a UDPConnector using the DatagramSocket available in AIR 2?
http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/net/DatagramSocket.html
February 9th, 2010 - 02:34
A UDPConnector is definitely planned and will probably be in the release after the upcoming one.