UStream Not Live

Posts Tagged ‘Flash’

PaintCanvas.as to SimpleDraw.as

April 7th, 2009

colorlinesTonight, I decided to look into some of these core files you can find in the Touchlib Library. If you haven't tried it out yet, there is a LOT of powerful stuff in there, but to me it seems rather tucked away. You need to open up the file and just read them to see what they intend to do. Then you can start to simplify.

Now the paint canvas file is used in the AS3\src\deploy\Paint.swf file. It give you a nice palette of color to choose from and uses Filters to blur and fade out and disperse the lines/dots as you draw them. Fact is that you are just dropping dots along a path to create the lines in the file.

Looking at that file, I wanted to pull out the most basic part. And maybe try to change it a little bit. So I don't really want to bring in the color picker, only the touch drawing part. And I want to change that to put down a random color for each time I get a new touch point. Read the rest of this entry »

Super Simple Multi-Touch Flash Drag

March 24th, 2009

-- Perhaps Too Simple

I was looking through all the TUIO files when I came across something interesting. In TouchEvents.as, there is a variable called 'relatedObject,' what did that mean I thought. So I opened up a new file and figured out how to run a trace on it. Low and behold, relatedObject will return whatever object it is touching. I knew this also when I touched the screen and the normal full sized black square I put on my files immediately followed my touch.

2 Lines of code! dragging accomplished, what?! Well, a little more than 2 lines (^_^), you need all the other code to hook in TUIO and add an event listener. So i tried putting just a bunch of random movie clips (not just shapes because they would be all created on the same level) on the stage. Each MovieClip could be moved independently, it's activated when the touch point moves and it'll snap the MovieClip's anchor point to the center of the touch point, but it's not without its issues. A few times when i dragged a MovieClip over another movie clip it'll connect to the one at the highest level. But it was something I stumbled across I though was worth sharing.

Name your AS file: SimpleDrag.as
Put into this folder structure: app/demo/MyTouchApp
In flash, set your Document Class to: app.demo.MyTouchApp.SimpleDrag

package app.demo.MyTouchApp{
 
	import flash.events.TUIO;// allows to connect to touchlib/tbeta
	import flash.events.TouchEvent;// allows to use TouchEvent Event Listeners
	import flash.display.*;
 
	public class SimpleDrag extends Sprite {
 
		public function SimpleDrag():void {
			//--------connect to TUIO-----------------
			TUIO.init(this,'127.0.0.1',3000,'',true);
			addEventListener(TouchEvent.MOUSE_MOVE, moveUpdate);//run moveUpdate, when any touching point is moved
 
		}
		public function moveUpdate(e:TouchEvent):void {
			trace("moved: "+e.ID+" related to: "+e.relatedObject.name);
			e.relatedObject.x = e.localX;
			e.relatedObject.y = e.localY;
		}
	}
}

Updated in my Google Code SVN page as well.

Happy Experimenting.

Introduction: Flash Google Maps API and Multi-touch

March 21st, 2009

There are many APIs out there to work with. If you start searching around Google, there are many people dedicated to helping people like you and me tie in different information and resources into Flash. It can take quite a long time just understanding a full API and be able to use ALL of it's capabilities. But that idea is way down the road. If you are like me, it's nice to find something to help you get off the ground. Read the rest of this entry »

Tutorial: Blob Lines

March 15th, 2009

There are two ways to work with multiple touch point that come to mind when developing multi-touch applications. One is to attach TouchEvents to the objects which are applied to the stage. The other is to use the array of blobs to build interaction between the blob points. In this tutorial I'd like to go over a basic setup you can use to communicate through the blob array, by drawing lines through all of the blobs that a activated on the stage. This app is built using the Touchlib classes for multi-touch communication with tBeta or Touchlib via FLOSC.

If you do not have the needed Touchlib files, you can find them here: http://code.google.com/p/touchlib/
by downloading touchlib-src-win32-20071106.zip from the download page, or downloading the source code via SVN in the Source section.

So begin with creating a new folder, i named mine "blobLines" and create a new Flash file, which I've named blogLines.fla
Then create another folder named "BlobsFunction" (this is case sensitive) in the "blobLines" folder, this will contain the AS file of the application.

Find the folder labeled "flash" from the Touchlib files, normally found in /AS3/int/
And copy this folder to your "blobLines" folder. This contains the TUIO classes needed for Flash to communicate with tBeta and Touchlib via FLOSC.

So now your "blobLines" folder should have: blogLines.fla, a folder labeled "flash" and a folder labeled "BlobsFunction"

Open the Flash file and set size setting to you screen's resolution, I use a 1024x768 size display, and change your framerate to 30fps.
Now open a new file, and create a new Actionscript file. Save as... BlobLines.as (this is case sensitive) Read the rest of this entry »

New Function for TUIO.as

March 11th, 2009

Building an array in a new AS file is redundant when the TUIO.as file already contains an array of all the TUIOobjects constantly updated everytime the XML from FLOSC is updated for tBeta or Touchlib. So I planned on figuring out how to access that information directly from TUIO.as

I started with converting some variables to public. It worked well, but after talking with a co-worker/developer, I realized that I should keep that var in the TUIO.as file private. So I needed a new way to gather the information. My first thought was to use some type of set/get to pull the information. After a few attempts, and getting no where. I realized there were already public functions that pass data from the TUIO.as file. So I simply added a new function that returns OBJECT_ARRAY.

public static function returnBlobs():Array{
	return OBJECT_ARRAY;
}

Then, in the new AS file I'm creating, all i have to use it TUIO.returnBlobs() and the returned value is already an array, ready to use, and every time TUIO.returnBlobs() is called, it is already up to date with the proper number to TUIOobjects in the array.

Download example Multi-touch Flash apps at: http://code.google.com/p/multitouchas3experiments/

multitouchas3experiments aka. Multi-touch Flash Actionscript 3.0 Experiments

March 8th, 2009

http://code.google.com/p/multitouchas3experiments/

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.

(-_-) ZZZ zzz ...

Multi-touch Flash Experiments

February 22nd, 2009

I've been working with the Touchlib library of multi-touch apps using Actionscript 3.0 to develop some of my own apps.  This driving force behind what I've been doing is to get a general idea of how to start thinking about the code, and try to discern what works well and what does not. I began with making a simple interface to select an app to be dynamically loaded into the main flash movie. The buttons and information is built dynamically and after an app is selected a trigger is placed in the bottom right corner the user will need to hold down to being back the menu. I've used that menu to build a small collections of apps i have been experimenting with:

  1. Rings, which works by extending RotatableScalable
  2. Grey Lines, which uses TouchEvent.MOUSE_DOWN and TouchEvent.MOUSE_UP to read any blobs which appear on the stage
  3. Squeegee, build an array of circles, then uses any blob information to rescale those circles based on their proximity to the blob, then uses the circles to mask an image which is revealed after you begin touching the screen
  4. Cats Cradle, loops through all the blobs on the screen and draws a line in order of how the array of blobs is constructed. Good for studying how blobs are added an removed from the array
  5. Physics, Flash Physics + Multi-touch -- a continued from the previous post

At the end of the video, I just wanted to give my thanks to NUIGroup, everyone there help me tremendously with getting my multi-touch hardware up and running. I hope to offer value by doing these experiments and letting the community use them as needed.


Multi-touch Flash Experiments from Chris Yanc on Vimeo.

Here are some thoughts I normally have when coming up with experiments like this. How can this be different than just something you can do with just  a mouse? It's one thing to get one touch point working and build an application around that. But how does it change when you can pretend there are 2 mouse cursors you can work with? Then 3? Then 4? What is the best way to optimize the code for these applications? How can I take this and build something useful for a business? Is a gaming environment the best option for thinking of commercialization opportunities?

I feel this technology has opened some interesting windows of opportunity.

And once again, I'd like to offer all my source code for the video above to anyone who'd like to dissect it.

Multi-touch Flash Experiments - Feb 22,2009

Touchlib – Gesture Update

January 17th, 2009

I'm currently fascinated by touch screen techonology. And I'm learning and doing all that I can to hopefully growing the technological savvyness of my fair city, Cleveland OH. But it's all about taking everything one step at a time. With that, I've been looking into various open source code bases to run my multi-touch rear projection display. I've been favoring TouchLib and tBeta. Within their libraries for implimenting Flash for communications with a TUOI interface I found a gesture recognition example. I loaded it up, but nothing worked for the touch screen, it worked for the mouse however, so the base structure was there.

I started looking through the code and parts of the Touch based functionality was there, it just needed to be wrapped up. So I tinkered around until I got it completely functioning. If you are familiar with the Touchlib SVN download, you can take this file: Gesture Update and update the files in: \AS3\int\app\core\action\gestures

Again, it's all about the baby steps, now to take this code and figure out how to expand it's use.

(^_^)//

Gesture Update Download