Alice Community  

Go Back   Alice Community > Alice 3 > How Do I?

Reply
 
Thread Tools Display Modes
keyListener & MouseButtonListener
Old
ekpalmer
Guest
 
Status:
Posts: n/a
Question keyListener & MouseButtonListener - 08-13-2009, 09:52 PM

When I use the listeners, I can get Alice to respond to mouseclicks and keypresses perform actions in response to these events.

I would like to distinguish between which mouse button was pressed and which key was pressed on the keyboard.

I have not been able to do this. I want do something different when an "A" is typed on the keyboard than when a "B" is typed.
   
Reply With Quote
A second on the question
Old
DrJim
Guest
 
Status:
Posts: n/a
Default A second on the question - 08-14-2009, 01:19 PM

I would also like to know this. If anyone has been successful, please post your results.

I have been successfull in importing my Alice programs (which make setting up animations easy) into NetBeans and then adding "full function" listeners there - but that, unfortunately is a one-way path as far as I can tell.
   
Reply With Quote
Old
ottosparks
Senior Member
 
ottosparks's Avatar
 
Status: Offline
Posts: 117
Join Date: Mar 2007
Location: here
Default 10-09-2009, 08:31 PM

Interesting.

I haven't toyed around with 3.0 enough to figure this out.

By the way, did anyone miss me? :3


I'm more lopsided than a three-legged badger!
   
Reply With Quote
just figured this out...
Old
antmj2317
Guest
 
Status:
Posts: n/a
Default just figured this out... - 10-20-2009, 05:47 PM

Ok, so the question is how to use events

Step 1: add an object to the world, any object, you can even use the camera if you want

Step 2: in that object's procedures, add a keyeventlistener method to your code

Step 3: drag an if block inside the key listener and select 'true'

Step 4: select the arrow next to 'true' and select 'keyevent e =' then proceed to select whatever key you wish to bind to whatever action

This is in the alice 64 build, I also noticed you cannot direct OTHER objects by adding a keylistening to the scene, in other words, the listening must be added to the object itself, as it would be a class level listener.
   
Reply With Quote
Old
geek in training
Junior Member
 
geek in training's Avatar
 
Status: Offline
Posts: 6
Join Date: Jul 2011
Default 08-01-2011, 01:31 PM

Quote:
Originally Posted by antmj2317 View Post
Ok, so the question is how to use events

Step 1: add an object to the world, any object, you can even use the camera if you want

Step 2: in that object's procedures, add a keyeventlistener method to your code

Step 3: drag an if block inside the key listener and select 'true'

Step 4: select the arrow next to 'true' and select 'keyevent e =' then proceed to select whatever key you wish to bind to whatever action

This is in the alice 64 build, I also noticed you cannot direct OTHER objects by adding a keylistening to the scene, in other words, the listening must be added to the object itself, as it would be a class level listener.
you can also use "e is key (choose a key)" instead of keyevent e=

thanks so much! I started a thread myself trying to figure out how to do that. no one knows how.

Last edited by geek in training; 10-02-2011 at 02:30 PM. Reason: used the word "forum" instead of "thread"
   
Reply With Quote
Reply

Tags
events, keyboard, mouse click events

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.