1 of 2
1
FIXED: Need Assistance w/ KeyboardObject and TextObject
Posted: 18 May 2008 11:48 AM   [ Ignore ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

Hey guys,
i’ve been looking around the SVN and found KeyboardObject.as and TextObject.as, I’m trying to load them in my loader (local.as), i’ve called them on stage im okay with that. but Im having trouble connecting the KeyboardObject with the TextObject. Below Im adding both the keyboard object and text object, where t in the TextObject is the Text Field i just cant find the function which links the parameter of keyboard object with the text field.

//Keyboard, Text, and SD Card Monitor
keyboard_0 = new KeyboardObject();
thestage.addChild(keyboard_0);
text_0 = new TextObject();
thestage.addChild(text_0);
keyboard_0./*connect to textfield*/(text_0.t);

I know you guys are brilliant at this so any help you can provide would be very beneficial. I just don’t wanna go around writing my own keyboard and text objects… being a bit lazy atm. tongue wink

Thanks

Taha

**UPDATE**
Also when i add the KeyboardObject to stage TUIO simulator stops functioning, atm the moment i dont know whether this is because flosc stops working or what because i can see that the flosc server is still running…

**UPDATE**
Thanks to Nuiman and Cerupcat, i got it to work, you need to compile it in FD. If anyone needs the FD project i can provide it to them.

 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 19 May 2008 04:12 AM   [ Ignore ]   [ # 1 ]
Avatar
RankRankRankRank
Joined  2006-11-09
Total Posts:  1017
Administrator

Hiya, Try this please smile

Also make sure you import the Keyboard and Test Object properly.

n_txt = new TextObject(' text object ',true);     
n_txt.name 'TextObject_0';
n_txt.closeButton=true;              
this.addChild(n_txt);    
              
n_keyboard = new KeyboardObject();
n_keyboard.name "Keyboard";
this.addChild(n_keyboard);

 Signature 
Profile
 
 
Posted: 19 May 2008 10:10 AM   [ Ignore ]   [ # 2 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

Hey Nuiman,
Thanks for the help, with what you suggested the keyboard and text object didn’t appear i had to change code very slightly by changing this.addChild(n_txt); to thestage.addChild(n_txt); and same for the keyboard.

import app.core.object.TextObject;
import app.core.object.KeyboardObject;
*********************************
*********************************
n_txt = new TextObject(' text object ',true);     
n_txt.name 'TextObject_0';
n_txt.closeButton=true;              
thestage.addChild(n_txt);    
              
n_keyboard = new KeyboardObject();
n_keyboard.name "Keyboard";
thestage.addChild(n_keyboard);

I have a couple of questions, and another problem, regarding these objects if you could help me solve.

firstly, the Text Object function has 2 parameters, inVar of type String and _closeButton of type Boolean, i was wondering what does the first inVar:String parameter does?
Also looking at the code you provided and going through the KeyboardObject, i now believe you connect the 2 objects, by setting the name of the TextObject to “TextObject_0” is my inference correct?

and finally this is the problem i’m having at the moment. Both the text object and keyboard appear on the screen however when the keys are pressed on the keyboard the text field does not get updated. also looking at the TextObject code i believe when the TextObject is first loaded by pressing the “enter” key the text field should contain ‘~’. However mine does not. Any reason why it does not work.

Thanks again for the help, greatly appreciated.

Taha

***UPDATE***
The reason why this wasn’t working was because the fonts weren’t embedding in the swf, and since the method for embedding fonts in Flash CS3 is ridiculously difficult… This project was converted from Flash CS3 to FlashDevelop, where it compiles very easily. If anybody needs help with this i’m gladly here to help.
And a special thanks goes out to Nuiman and Cerupcat for helping me out.

Taha

Image Attachments
no font.jpg
 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 14 December 2008 07:12 AM   [ Ignore ]   [ # 3 ]
Rank
Joined  2008-11-15
Total Posts:  38
New Member

Hi,
now, I also have a problem with the keyboard object:

I work with CS4, and when I try to add the keyboard to the stage, it throws a lot of errors:
First, I add the KeyboardObject and the TextObject

import app.core.object.KeyboardObject;
import app.core.object.TextObject;

Then I declare n_txt and n_keyboard:

private var n_txt:TextObject;
private var 
n_keyboard:KeyboardObject;

Then I call it using this:

n_txt = new TextObject(' text object ',true);     
            
n_txt.name 'TextObject_0';
            
n_txt.closeButton=true;              
            
stage.addChild(n_txt);    
              
            
n_keyboard = new KeyboardObject();
            
n_keyboard.name "Keyboard";
            
stage.addChild(n_keyboard);

But I get a lot of errors from the KeyboardObject, and I doesn’t work

Do I have to add some code to mine?

Thanks for helping a noob^^

Bye,

Movie

Profile
 
 
Posted: 14 December 2008 01:46 PM   [ Ignore ]   [ # 4 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

No, thats all you need… it should work, can you copy and paste the errors here so we can more easily solve your problem

 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 15 December 2008 09:30 AM   [ Ignore ]   [ # 5 ]
Rank
Joined  2008-11-15
Total Posts:  38
New Member

Well, I’ve got the german version of CS4, so I try to translate it:
Many Errors like
“Function “getChildByName” not found”
and
“Cannot call a undefinded function “noSelection = true;"”
and
“undefinded property “relatedObject"”

and some more…

I did not changed the code, I double checked it ^^

Maybe it’s CS4 fault?

Bye,

Movie

Edit//: Ok, I tried it with the english version of CS3, and here are the errors:

1120Access of undefined property noSelection.
1118Implicit coercion of a value with static type flash.display:DisplayObject to a possibly unrelated type flash.display:MovieClip.
1061Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.
1119Access of possibly undefined property relatedObject through a reference with static type flash.events:Event.
1119Access of possibly undefined property relatedObject through a reference with static type flash.events:Event.
1061Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.

Profile
 
 
Posted: 15 December 2008 11:24 AM   [ Ignore ]   [ # 6 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

I dont think u’re importing everything… also like i’ve said above Flash CS3 has a weird way of importing things… it didnt work in Flash CS3 for me thats why i switched to Flash Develop… it also works in Flex as well.

 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 29 January 2009 09:41 PM   [ Ignore ]   [ # 7 ]
Rank
Joined  2008-09-21
Total Posts:  17
New Member

I was trying the keyboard object after seeing this thread and thanks to the code suggested, it worked. I was using Flex and I had to make sure the ‘keyboard.swf’ referred to in the ‘KeyboardObject.as’ is accessible in the \bin-debug and \src folder for flex to compile ok and run.

I was looking into the ‘KeyboardObject.as’ file and there is this code statement in the various keyboard button events that goes :

“var t:TextFiled = parent.getChildByName(’TextObject_0).getChildByName(’t’);”

I’m still learning AS3 as I go along...and I would like to ask what the last “.getChildByName(’t’)” meant. What object is named as “t”, I could not find any in the keyboard.fla file.

Thanks.

Profile
 
 
Posted: 10 February 2009 11:15 AM   [ Ignore ]   [ # 8 ]
Rank
Joined  2008-07-07
Total Posts:  87
New Member
Movie85 - 15 December 2008 09:30 AM

Well, I’ve got the german version of CS4, so I try to translate it:
Many Errors like
“Function “getChildByName” not found”
and
“Cannot call a undefinded function “noSelection = true;"”
and
“undefinded property “relatedObject"”

and some more…

I did not changed the code, I double checked it ^^

Maybe it’s CS4 fault?

Bye,

Movie

Edit//: Ok, I tried it with the english version of CS3, and here are the errors:

1120Access of undefined property noSelection.
1118Implicit coercion of a value with static type flash.display:DisplayObject to a possibly unrelated type flash.display:MovieClip.
1061Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.
1119Access of possibly undefined property relatedObject through a reference with static type flash.events:Event.
1119Access of possibly undefined property relatedObject through a reference with static type flash.events:Event.
1061Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.

In Publish Settings , Click on settings (Near “ActionScript Version” Combo box) and disable the Strict mode errors check box.

Well, in spite of not being the best of signals to not to work on strict mode it should run fine now.

I’ve done that, now i’m struggling with the text that don’t seems to appear. Embedding font problem? I’m on CS3 (OsX).

Profile
 
 
Posted: 10 February 2009 11:37 AM   [ Ignore ]   [ # 9 ]
Rank
Joined  2008-07-07
Total Posts:  87
New Member

Can anyone help me with this?

I’ve puted on KeyboardObject.as the following trace

trace("KEYPRESSED:"+ch+"|New text: "+t.text);

and everything it’s working fine, i can see the text being held.
But nothing appears on screen, only the text field (i think) blinks when i hit the first key.
I’ve tried to put the font allover. I’m using flash CS3 on MacOSX.

here is the code of the example class:

TUIO.initthis'localhost'3000''true );
            
n_txt = new TextObject('text object ',true);     
n_txt.name 'TextObject_0';
n_txt.closeButton=true;              
stage.addChild(n_txt);    
n_txt.500
n_txt.500
n_keyboard = new KeyboardObject();
n_keyboard.name "Keyboard";
stage.addChild(n_keyboard);
n_keyboard.500
n_keyboard.500;



Any idea? tks.

Profile
 
 
Posted: 11 February 2009 07:44 PM   [ Ignore ]   [ # 10 ]
Rank
Joined  2008-09-21
Total Posts:  17
New Member

There seems to be nothing wrong with your code. I copied your code and put it in place of mine and I could get a text to show up on the textfield. I’m on windows XP and using Flex 3. Have you try closing the first text and touching the ‘Enter’ key to let it generate a new textfield?

Profile
 
 
Posted: 11 February 2009 09:22 PM   [ Ignore ]   [ # 11 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

What you are doing should work i see no reason for it not too. On the other hand it may be an issue with CS4 cause i remember the first time i tried this it wouldnt work either and i was on CS3 so i moved to FlashDevelop and since then its worked perfectly to the point where i switched from CS3 to FD

 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 11 February 2009 09:44 PM   [ Ignore ]   [ # 12 ]
Rank
Joined  2008-09-21
Total Posts:  17
New Member
Taha - 11 February 2009 09:22 PM

What you are doing should work i see no reason for it not too. On the other hand it may be an issue with CS4 cause i remember the first time i tried this it wouldnt work either and i was on CS3 so i moved to FlashDevelop and since then its worked perfectly to the point where i switched from CS3 to FD

I thought he is using Flash CS3 on Mac?

Profile
 
 
Posted: 12 February 2009 12:09 AM   [ Ignore ]   [ # 13 ]
Avatar
RankRankRankRank
Joined  2008-02-12
Total Posts:  842
Moderator

yeah you’re rite
my mistake sorry

 Signature 

My MultiTouch Blog
My Youtube

Profile
 
 
Posted: 12 February 2009 02:58 PM   [ Ignore ]   [ # 14 ]
Rank
Joined  2008-07-07
Total Posts:  87
New Member

Ok,

I’ve found the solution:

I din’t know until know that flash and flex deal with fonts differently. I guess touchlib AS3 developers developed in flexbuilder or flashdeveloper (flex compiler anyway).

So, as Knar pointed out “i have created a font in the fla and linked to flash.text.Font and modified ...” TextObject so it uses the flash include font.

A tutorial on exporting flash runtime fonts can be found here.

Profile
 
 
Posted: 07 July 2009 05:36 AM   [ Ignore ]   [ # 15 ]
Rank
Joined  2008-10-29
Total Posts:  13
New Member

hey guys, is any of you using Mac and has the KeyboardObject and TextObject working? If soo, can you upload these two files? My keyboard and text object appear on the screen but when I hit a key on the keyboard the text doesn´t show… :/ I think that at least the TextObject.as is different than yours!
Thanks everyone wink

Profile
 
 
   
1 of 2
1