I'm so excited that I finally got to work on some experimental Flash at my professional employment. It is a nice change of pace to push an idea to the limits...and then some. In fact, I'm still not done working on the possibilities. This was only the starting point. Making text fall. Tie it into the Box2DFlash Physics Engine.
I want to give yet another shout out to Emanuele Feronato. If you are looking at this code, and are completely lost, he has EXCELLENT tutorials to get you started. Thats where I ended up taking my first steps in Box2DFlash.
Now in the guise of learning. I don't intend on going too indepth with the code...there is a lot going on. But hopefully, by breaking it down into phases, you can understand my building process. Something like this isn't accomplished in one chunk of code. It is build up by steps. At least the way I code. Read the rest of this entry »
Here's the link, it's the whee hours of morning now. But it has been quite an eventful saturday.
And now I just realizied I lost another hour today...Daylight savings time. At least I can actually say that there just weren't enough hour(s) today and mean it.
Well, I plan to keep the SVN files in the googlecode page up to date as much as possible. So grab em' learn from them, I plan on explaining my thoughts and why I did thing and how and why they work and now I'm using a lot of ands. Ok, may be it's time to get a little sleep.
I've been wanting to use physics and multi-touch together. But physics calculations + ME = Years and years and years. But, there are already solutions that I can use to create physics based applications in Flash, but there are many to choose from. So I slowly started sifting through all the choices to find one I understood and work with.
It took a little while, but I began to make sense to me, at least the intial tutorial did, and the additional tutorials that I could find online. Emanuele Feronato » italian geek and PROgrammer IS MY FLASH PHYSICS HERO!
I took built an enclosed area around the outside of the projected screen with 4 walls. Then started with just building a regular flash app which the mouse clicks on a circle, you can drag the circle around and the other circles react to it, just using the normal MouseEvent.MOUSE_DOWN. Done, next. Next I changed the MouseEvent to a TouchEvent, changed the rest of the code as needed to work with just 1 touchpoint. That took a little while to hammer out, and got a bit frustrating here and there. Till I acutally understood everything that was going on in the code when it came to Mouse/Item interaction. Touch and empty part of the stage, new circle, touch a circle, it follows the touchpoint. Done Again.
Finally, get it to understand different touchpoints at the same time. A lot to think about in that one. My solution in a nutshell is that any and all touchpoints are collected into an array, along with the corresponding circle (if the touchpoint is indeed touching a circle), then the code to update any touched circles loops through the array of touchpoints and adjusts the circles positions accordingly. I do not pretend to be a master flash coder in any sense, so I do not know if this is the Best solution, BUT it works and it works very very well, even on a non-high end computer. And I am quite happy with the refresh rate of it all.
Video for show, 3 app demos, 1st is the fire app (comes with Touchlib), 2nd ring app (example from NUI Group), 3rd my physics app demo.
Multi-touch Flash Apps from Chris Yanc on Vimeo.
Quality Note: The compliant surface has temporarily buckled because of the temperate/humidity shift in the weather. I'll be reworking how I lay out the compliant surface next.
I've zipped the files I used, I've edited some of the Touchlib AS files so these files probably won't work if you use the real downloaded version of the Touchlib AS files.