1 of 2
1
Imagine a total beginner needing a pointer or four…
Posted: 01 February 2008 03:00 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  232
Joined  2008-02-01

Hello everyone.

OK, first off I am a total beginner to this kind of thing.  I’m new to Flash, and whilst more than capable of building apps in Quartz Composer for a fiducial table, am at a total loss when it comes to this blob stuff.

So, I’m looking for help.  Are there any tutorials which explain how to build a basic app for NUI using CS3?  Sadly, I don’t own any older versions of Flash and of course, Adobe will not supply them (I have asked).  I only need something basic to start, maybe an operating button which makes something else happen.

Is there a list of the functions which make these things work in AS3?  So instead on a mouse click event there would be a what? for example.

Also, as I use Mac at home and PC at work, is there a way to test my apps on my Mac, without the blob detection working, then transfer this to the machines at work, where they’d be used?  I understand I would have to change some code, I’m happy to do this.

Basically, where would you point a total idiot who wants to build simple little apps in Flash for use with NUI?

All help greatly appreciated.

L.

 Signature 

fingerpuk.tumblr.com

Profile
 
 
Posted: 01 February 2008 06:49 PM   [ Ignore ]   [ # 1 ]
New Member
Rank
Total Posts:  94
Joined  2007-08-01

Hello Larky,

I have the start of a tutorial. If your interested drop me an email and i will send it to you.

 Signature 

Brett Forsyth
Blog: http://blog.thestem.ca
My Mult-touch build: http://ddblog.vfs.com/category/multi-touch/
Where I teach: http://vfs.com/fulltime.php?id=13

Profile
 
 
Posted: 01 February 2008 09:17 PM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  531
Joined  2006-11-09

Hey Larky make sure you check out http://nuigroup.com/zip/learnAS3.rar

Its a archive of my personal samples should really help get you started on AS3..

As for the Touch API in AS3 its pretty straight forward initially all you have to learn is the syntax for the “TouchEvent” system

Here is a lil sample of how you would make a simple button:

import flash.display.Sprite;
import flash.events.*;

// Init Touch API
TUIO.initthis 'localhost'3000''true );

// Draw Button
var n_sprite = new Sprite();
n_sprite.graphics.beginFill(0x000000);
n_sprite.graphics.drawRect(0,0,100,100);
this.addChild(n_sprite);

// Mouse
n_sprite.addEventListener(MouseEvent.MOUSE_DOWNdownFunction);

// Touch
n_sprite.addEventListener(TouchEvent.MOUSE_DOWNdownFunction);

public function 
downFunction(e:Event){
trace
(e);
}

Also here is a general list of current “TouchEvents” -

MOUSE_DOWN
MOUSE_MOVE
MOUSE_UP
MOUSE_OVER
MOUSE_OUT

Still Beta:
CLICK
DOUBLE_CLICK
MOUSE_UP_OUTSIDE

 Signature 

~

Profile
 
 
Posted: 02 February 2008 06:16 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  232
Joined  2008-02-01

Hey.  Thanks for the heads up, and the offer a of a tutorial (PM sent).  I’ll get looking through that RAR now. smile

 Signature 

fingerpuk.tumblr.com

Profile
 
 
Posted: 04 February 2008 03:07 AM   [ Ignore ]   [ # 4 ]
New Member
Rank
Total Posts:  52
Joined  2007-11-01

how do you want to realize the doubleclick?! via set intervall ?

Profile
 
 
Posted: 04 February 2008 03:24 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1306
Joined  2007-04-08

damilogez, we already have a doubleTap (Click) working. I integratted it into rotateablescalable.as class right now. We’re going to change that and add it to the events that are dispatched soon which is why it’s considered beta. I also just wrote a “hold” event that is also in rotateablescalable.as class. Maybe this one will/should be added into the events also.

It’s not using a set Interval (that’s more AS2). The doubleTap uses getTimer() and checks to see if the second tap is within the allowed timeframe and also within a set radius of the first tap. If it is, then it counts as a doubleTap. The timeframe and radius can both be changed.

P.S. - good to have you here Larky!

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 04 February 2008 04:39 AM   [ Ignore ]   [ # 6 ]
New Member
Rank
Total Posts:  52
Joined  2007-11-01

is this class public? in the one i have here (as3-09-11) around i dont see this method.

Profile
 
 
Posted: 04 February 2008 12:58 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1306
Joined  2007-04-08

Yes it’s public and in the touchlib svn. I recommend always using the svn as that’s where you’ll get the latest updates. Download the trunk/AS3 folder. http://code.google.com/p/touchlib/source/browse Look for the rotateablescalable.as class and search for DoubleTap. Currently it’s something that is always called when a object extends rotatablesclable and you use function override doubleTap(){} to control what you want to happen when a doubletap occurs.

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 11 February 2008 04:35 AM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  232
Joined  2008-02-01

Hi all.  I spent the weekend learning some more AS3, it’s starting to make much more sense now.  However, I’m still having trouble hooking up touchlib to AS3.

When I try to use

public function downFunction(e:Event){
trace(e);

I get an error stating that public functions doesn’t exist inside a package?

I have mouse events triggering functions, and we can get example flash touchlib files to work fine, so I know it’s me getting it wrong.  Would it help if I post the code?

Take care, A.

 Signature 

fingerpuk.tumblr.com

Profile
 
 
Posted: 11 February 2008 11:28 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1306
Joined  2007-04-08

well how are you calling the event? Are you creating an AS file or are you putting actionscript directly on the timeline? If on the timeline, I think you need to take out the “public” part and let it be just “funcion downFunction(e:Event)”

If in a AS file (a package), You would do something like:

object.addEventListener(TuioEvent.MOUSE_DOWN, downFunction);

Then somewhere else in the file you’d have:

public function downFunction(e:Event){

trace(e)
}

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 11 February 2008 02:43 PM   [ Ignore ]   [ # 10 ]
New Member
Rank
Total Posts:  94
Joined  2007-08-01

Just as a small point it should read when using the newest TouchEvent files.

object.addEventListener(TouchEvent.MOUSE_DOWN, downFunction);

public function downFunction(e:TouchEvent){

trace(e)
}

 Signature 

Brett Forsyth
Blog: http://blog.thestem.ca
My Mult-touch build: http://ddblog.vfs.com/category/multi-touch/
Where I teach: http://vfs.com/fulltime.php?id=13

Profile
 
 
Posted: 12 February 2008 02:30 AM   [ Ignore ]   [ # 11 ]
Jr. Member
RankRank
Total Posts:  232
Joined  2008-02-01

Hello.  Thanks for all the advice, sadly it still isn’t working.  I’ve even tried copying and pasting the code from c.moore but it fails to work (but gives no errors on export).  I’ll try what Sr. Member suggests.

Ta, A.

 Signature 

fingerpuk.tumblr.com

Profile
 
 
Posted: 12 February 2008 02:43 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1306
Joined  2007-04-08

brettf, you actually shouldn’t have to do (e:TouchEvent) and should be able to do (e:Event); For example I have code where both touchevents and mouse events use the same function. The only way to do it is by saying (e:Event) and not MouseEvent or TouchEvent. Then you can put inside the function something like

if(e is TouchEvent) { do something}
if(e is MouseEvent){do something}

This way you dont have to have seperate functions for both mouse and tuio events. =)

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 12 February 2008 06:50 AM   [ Ignore ]   [ # 13 ]
Jr. Member
RankRank
Total Posts:  232
Joined  2008-02-01

Hi all.

OK, We have a working flash file which moves an icon around depending upon where the mouse clicks.

We add the import com.touchlib.TUIO;

and then TUIO.init( this , ‘locallhost’, 3000, ‘tru’ );

and then use this.addEventListener (TouchEvent.MOUSE_DOWN, downFunction);

but we always get error 1065 Variable TUIO undefined.

We can open example scenes and they work fine, but if we take our own or another example scene set up for mouse clicks and add the code, it never works!  Any ideas?

A.

 Signature 

fingerpuk.tumblr.com

Profile
 
 
Posted: 12 February 2008 11:04 AM   [ Ignore ]   [ # 14 ]
New Member
Rank
Total Posts:  94
Joined  2007-08-01

TUIO isn’t in com.touchlib any more. It is now stored in flash.events So are you using the latest code if so thats the change you have to make.

cerupcat: True enough. I personally don’t double up a lot of times and I am just being explicit. But your right polymorphism should take care of that one.

 Signature 

Brett Forsyth
Blog: http://blog.thestem.ca
My Mult-touch build: http://ddblog.vfs.com/category/multi-touch/
Where I teach: http://vfs.com/fulltime.php?id=13

Profile
 
 
Posted: 12 February 2008 03:15 PM   [ Ignore ]   [ # 15 ]
Jr. Member
RankRank
Total Posts:  232
Joined  2008-02-01

Ahh, thanks.  Sorry if I’m being incredibly slow and annoying, trust me it’ll get better when it ‘snaps’ into place. smile

 Signature 

fingerpuk.tumblr.com

Profile
 
 
   
1 of 2
1