Joysticks Applets Javascript I need some advice

What’s up,

I am new to all of this and I need some advice. I need to be able detect and use a joystick in an applet but pass the pull events to javascript/flash. I have something that does this already but it only works on PCs and only in IE (active x). I was thinking that using java it would take care of my platform/browser problem. So the questions I have are… well I have a bunch.

  1. Is it possible to send variable from applets to javascript/actionscript
  2. What API should I use? Jinput, java3d, etc
  3. Will the clients have to have special components installed?
  4. Which one will support serial/ paralel and usb joysticks?
  5. Where can I find some code snippets to try this out.

Thanks in advance for any information that you post.

  1. Yes
  2. Jinput
  3. Yes, and here’s the problem. There’s no way to automatically install the required native library using an applet. You could try signing the applet, streaming the native code to disc, but trying to get java to recognise it as a valid extension is a problem.
  4. See 2. (don’t think it does parallel though)
  5. You probably won’t find code for jinput & java/javascript all in one code snippit. I’d look in the Jinput forum. I believe there’s an article about java/javascript communication on the sun website somewhere.
  • try “java javascript communication” in google
  • there are some tests in net.java.games.input.test package of jinput
    Alan
  1. Under windows, if directx picks it up, jinput can use it
    Under Linux, if there are js* or event* nodes in /dev/input then it will (should) work
    Under mac, it’s all a little dubious, we have no active osx jinput developers right now.

If you need JInput help, then i sit on that forum, i’m no javascript expert though i’m afraid.

Endolf

Thanks for the help/advice. I have been looking into Java3d all day and I couldn’t really find anything.

Here is a good tutorial I found on jinput.
https://freefodder.dev.java.net/tutorial/jinputTutorialOne.html

Where can I get some more information about #3?

“3. Yes, and here’s the problem. There’s no way to automatically install the required native library using an applet. You could try signing the applet, streaming the native code to disc, but trying to get java to recognise it as a valid extension is a problem.”

Does this mean that even if the JRE is installed on the computer, the jinput stuff will not work? I am a real newbie and I am not even sure what you mean by native library. Would the users have to download a special library, put it in their java folders, change the class path, and a bunch of other stuff to get it to work? Is it going to be worth trying?

Thanks a lot for the responses.

Hi

There have been a couple of changes in the API since then, the idea being to make jinput easier to use. I’ll see if I can sort out getting the tutorial updated and/or placed in the jinput project.

Jinput uses a native library for each platform it runs on, this is because java itself has no exposed knowledge of direct input under windows, or the the event kernel interface under linux etc. So JInput has had to implement it’s own access to these to expose the devices. Using a downloaded application with it’s own installer, or using Java WebStart these native libraries are not an issue (see the jinput webstart demo). Using applets is harder though.

I’ve not done applets/flash much at all so I can’t help on that front. If you are determined to use javascript and flash then you’ll have to hope someone else can help. If you are happy using webstart to distribute your application, then pop on over to the jinput topic on these forums and we can get you up and running.

Endolf