Talking to a usb device when RIA app is installed locally - easier in silverlight or flex?
I'm creating a program that needs to communicate with a usb device when installed on the desktop, but doesn't need to access the device when running in the browser. 开发者_Python百科Hopefully this would remove the need for doing any browser-dependent extensions/hacks to work.
Would silverlight 4 let me call a native process to do this (presumably via COM), or are things still tightly sandboxed? Supposedly there's a hack to do this ( google "silverlight 4 native process" )
Would using flex/adobe air be easier to achieve this? The latest version of flex seems to support access to native processes ( http://www.adobe.com/devnet/air/ajax/quickstart/articles/interacting_with_native_process.html )
I can't speak to Silverlight, but with Flex..
I'm creating a program that needs to communicate with a usb device when installed on the desktop, and the application also has an 'offline' mode which can run in the browser.
If I understand this, you need an application that will run in the browser and on the desktop, correct? Usually browser based applications are not referred to as "offline", but that is what you called it. Did you really mean to do that?
In Flex, I think you're limited to the type of USB Devices you can access. A Printer? Probably not! A card reader, or bar code scanner will act just like any other input device. Flex will support them no differently than a keyboard (both in the browser and on the desktop). A USB Drive? You should be able to access it via the File API (in AIR, but not in the browser). In AIR 1 if you plugged a drive in while the app was running it would not be accesible, but I believe this limitation was corrected. I'm not sure if it was corrected in AIR 1.5 or AIR 2, though.
A USB Microphone or web cam? They should be accessible both in browser and in AIR. I'm not sure if they'll be found if you plug them in after the app is loaded though.
My suspicion is that you'll need to elaborate on the type of USB device for specifics. I'll add that NativeProcess is an AIR specific feature and will not work in the browser all.
I also believe that Silverlight and Flex in the browser will have similar limitations in accessing external devices, due to the sandbox that the browser puts the app in.
Does this help?
Neither Flex or Silverlight will be able to connect directly to your USB sound sequencer. You will need to connect to the driver layer via some native software for the OS(es) you want to use and then connect the Flex or Silverlight app via NativeProcess or local TCP sockets.
精彩评论