View Single Post
  #3 (permalink)  
Old 10-12-2004, 06:21 AM
SWFKit SWFKit is offline
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Serial Port communication using SWFKit

E.g. The "querymodem" script in the "querymodem" sample, the last line is
Code:
commx.writeStr(command);
You can change it to
Code:
var stream = new StringStream;
stream.write(command);
commx.write(stream);
The "stream" object contains the binary data and is sent by the "write" method.

Similarly, in the "initialize" script, the "onRXChar" event handler is
Code:
var str = this.readStr(count);
FlashPlayer.setVariable("response.text", str);
trace(str);
It can be changed to
Code:
var stream = this.read(count);
FlashPlayer.setVariable("response.text", stream.toString());
trace(stream);
The "read" method returns a stringstream object contains binary data.
Reply With Quote