Copy link to clipboard
Copied
I am building a kiosk program using Flash Air Desktop. The program features a product. There is a spot where I am using the htmlLoader to load the website if someone wanted to visit the website and possible purchase.
Once they are to the page with the HTML website loaded I need a virtual keyboard for them to use.
Windows comes with a virtual keyboard. Is there a way within AS3 to create a button that can be clicked and launch the virtual keyboard?
Thank you for your help.
Copy link to clipboard
Copied
The on-screen keyboard executable is located here:
C:\windows\system32\osk.exe
Since you're using AIR you can use NativeProcess, here's the API and some example code starting a process (you'd want to start the file above, but remember to \\ double backslash so c:\\windows\\system32\\osk.exe):
I myself always build a custom designed keyboard for my kiosks which is always another option for you. They're fairly easy to build and let you keep the keyboard focused and exactly where you want it. Otherwise people can move the keyboard around freely and it may not be inputting the correct target.
Copy link to clipboard
Copied
Thank you for the reply Sinious.
I will test out and see if I can get the virtual keyboard to launch.
Regarding building a keyboard. I looked at that and I bought a pre-built AS3 keyboard to see if I can implement. What I couldn't figure out was how to make a text input on the web page a target. Don't I have to give the target a name that I can reference in the AS3?
I'll respond back and let you know how launching the virtual keyboard plays out.
Thanks.
Copy link to clipboard
Copied
I guess I am too much of a novice. I am not understanding how to incorporate the "Package" code from the sample link you provided. The compiler with Flash give me an error "1083: package is unexpected."
Did I over look the instructions on how to incorporate the "package". I copied and pasted the "package" sample code into the AS window with in Flash and tried to test.
Thank you for any inout you might have.
Copy link to clipboard
Copied
Ok. I figured out Packages have to go into an ActionScript 3.0 class file.
I copied the code in and saved the AS file into the folder with my Flash file.
When I am in Flash looking at the AS file it list my Flash Kiosk file as the Target file for the AS Package file.
Now I am going to Publish the AIR file and include the AS keyboard file I made with it to see if that works.
Copy link to clipboard
Copied
nope. I didn't do that right. Still searching through steps on how to incorporate this NativeProcess.
I have purchased an AS3 keyboard but I cannot get it to type into the Form Inputs on the html page I have loaded with the htmlLoader in AIR. The keyboard will only type into space that are set as InputText. The AS3 keyboard does not recognize the loaded HTML pages Text Inputs.
I can use the Windows Virtual Keyboard to type into the HTML form fields. But I still need to work through how to actually call up the keyboard with the NativeProcess. Plus, I only need the keyboard to be called up with someone is visiting the htmlLoader portion of the kiosk. Not sure if I can call that up with a button as needed or not.
Thank you for any direction you may be able to provide.
Copy link to clipboard
Copied
Ok. I have worked my way through attaching an AS package to my FLA AIR file. At the moment I am working on a MAC so for testing purposes I am trying to launch a Photoshop App as a substitute for launching the Windows Virtual Keyboard. If I can get the Photoshop app to launch then I would assume I can swap out the Photoshop info for the Windows Virtual Keyboard info.
Here is the code I have placed in the AS file to launch the Native Progress. It is not working. It does not launch Photoshop when I run it.
- - - - - - - - -
package
{
import flash.display.Sprite;
import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.IOErrorEvent;
import flash.events.NativeProcessExitEvent;
import flash.filesystem.File;
public class NativeProcessExample extends Sprite
{
public var process:NativeProcess;
public function NativeProcessExample()
{
if(NativeProcess.isSupported)
{
setupAndLaunch();
}
else
{
trace("NativeProcess not supported.");
}
}
public function setupAndLaunch():void
{
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var file:File = File.applicationDirectory.resolvePath("/Applications/Adobe Photoshop CC/Adobe Photoshop CC.app/Contents/MacOS/Adobe Photoshop CC");
nativeProcessStartupInfo.executable = file;
var processArgs:Vector.<String> = new Vector.<String>();
processArgs[0] = "foo";
nativeProcessStartupInfo.arguments = processArgs;
process = new NativeProcess();
process.start(nativeProcessStartupInfo);
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
}
public function onOutputData(event:ProgressEvent):void
{
trace("Got: ", process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable));
}
public function onErrorData(event:ProgressEvent):void
{
trace("ERROR -", process.standardError.readUTFBytes(process.standardError.bytesAvailable));
}
public function onExit(event:NativeProcessExitEvent):void
{
trace("Process exited with ", event.exitCode);
}
public function onIOError(event:IOErrorEvent):void
{
trace(event.toString());
}
}
}
- - - - - - - - - -
When I run this an error 1046: Type was not found or was not a compile-time constant: NativeProcessExitEvent.
This piece of code is the 4 line up from the bottom in the code sample I posted below.
Does anyone have any inout on where I may have made my mistake?
Thank you.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more