NOTHING HAPPENS when trying a basic touch input (SOLVED)
Posted: 03 June 2008 01:30 AM   [ Ignore ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

edit: on the event handler i needed to change it from a mouse event to a touch event.

hi i am useing the example as3 that was given in one of the examples (see below) i am first runing flosc then running the TUIO simulator (so that i can simulate a touch panel) i am then runing my flash example from within FlashDeveloper.

everything seems fine the mouse works but when i try click useing the simulator i am not able to click on my square to get to it do anything
yet the record buttons work fine??

anyone know what i am doing wrong?

package
{
// General Imports…
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextFormat;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

// Internal Library Imports…
import com.sample.SampleSquare;

// External Library Imports… (you did not write)
import gs.TweenLite;
import flash.events.TouchEvent;
import flash.events.TUIO;
import flash.events.TUIOCursor;
import flash.events.TUIOObject;
import flash.events.TUIOSimulator;
import flash.events.TUIOEvent;

// Begin Class
public class Main extends Sprite
{
// Embed Font
[Embed(source = “../deploy/Arial.ttf”, fontFamily = “n_font")]
private var n_font:Class;
private var n_format:TextFormat = new TextFormat();
private var n_text:TextField = new TextField();
private var n_square:SampleSquare = new SampleSquare();

// Constructor Method - Adds a Custom Square (SampleSquare)
public function Main()
{
TUIO.init(this, ‘localhost’, 3000, ‘’, true);
this.addChild( n_square );
n_square.x = stage.stageWidth / 2;
n_square.y = stage.stageHeight / 2;

n_square.addEventListener(MouseEvent.MOUSE_DOWN, rotateObj);
n_square.addEventListener(TUIOEvent.TUIO_DOWN, rotateObj);
drawText();
}

// Adds Text to the Square
private function drawText():void
{
n_format.font= “n_font”;
// Not Shown…
}

// Tween Square with External Library (gs.TweenLite)
private function rotateObj(e:MouseEvent):void
{
Trace(’click’wink;
TweenLite.to(n_square, 1, {rotation:360,tint:Math.random()*0xFFFFFF}wink;
}
}// End Class
}

Profile
 
 
Posted: 03 June 2008 03:02 AM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

I am no expert by far and I dont pretend to understand the errors above. What you could try is instead of importing all your events seperately use this line;

import flash.events,*; - for mouse events etc

and then again;

import flash.events.*; - for the TouchEvents

This will import the whole package and save you a bit of typing.

It might help?

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 03 June 2008 03:06 AM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

i got rid of the errors by noticeing that i wasnt useing TUIOEvent.TUIO_DOWN

now that i have changed it is is just not doing anything???

Profile
 
 
Posted: 03 June 2008 03:08 AM   [ Ignore ]   [ # 3 ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

at least im not geting an error i guess

Profile
 
 
Posted: 03 June 2008 03:11 AM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

So does it work with the Test.exe sample file (ripples) that is in the simulator package?

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 03 June 2008 03:15 AM   [ Ignore ]   [ # 5 ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

i assume you mean if i could get test.exe working when running flosc and the simulator and yeh i could so i dont think that its a flash security setting *puzzled look*

Profile
 
 
Posted: 03 June 2008 03:18 AM   [ Ignore ]   [ # 6 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

rolleyes

Ok well you will have to hope one of the elite see this thread....

Good luck

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 03 June 2008 03:18 AM   [ Ignore ]   [ # 7 ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

thanks anyway

Profile
 
 
Posted: 03 June 2008 03:37 AM   [ Ignore ]   [ # 8 ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

have been looking at TUIO.as and notice that they use TouchEvent.CLICK for example now im confused :-s

Profile
 
 
Posted: 03 June 2008 03:54 AM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  132
Joined  2008-03-11

CLICK = MouseDown AND MouseUp again
MOUSE_DOWN = MouseDown
MOUSE_UP = MouseUp etc…

 Signature 

~ myHead.addEventListener(Event.ENTER_FRAME, functionProperly); ~

Profile
 
 
Posted: 03 June 2008 03:56 AM   [ Ignore ]   [ # 10 ]
New Member
Rank
Total Posts:  12
Joined  2008-05-01

have sorted it out silly me i had not changed the eMouseEvent to eTouchEvent

thanks for your help now that i have something basic lets see what i can get this to do grin and learn some AS3 :-s

Profile