onCOMPortData This page was last modified over 30 day(s) ago and has 0 comment(s)

Back to COMPort Class Summary

The COMPort Class has been deprecated in Zinc 4.0. It is included for legacy support but is no longer maintained and maybe removed completely in a future 4.x update.





Dispatched when data has been received through the serial port. The received object (event) will contain opaque data point "data" property with following properties with actual data:
- data:String - data received through comport in string format
- timeCode:Number - unix time when data was recieved

The event type is "onCOMPortData"

There are two ways to listen for events in 4.0:
using "onEventNameFunction" - callback based handlers introduced in {mdm} 2.0
using IEventListener model based on Events introduced in 4.0.

No matter what implementation you would use either callback and listener handler would have to use single-argument defintion as in below sample:
// callback based handlers
mdm.Appllication.onAppChangeFocus = function(event:Event):void
// proceed with event

// handlers based on IEventListener model
function onAppChangeFocusHandler(event:Event):void
// proceed with event

Example Code
mdm.COMPort.onCOMPortData = function(event:Object):void
// or
mdm.COMPort.onCOMPortData = function(event:mdm.Event):void
var data:String = event.data.data;
var time:Number = event.data.timeCode;

function onDataHandler(event:mdm.Event):void
var data:String = event.data.data;
var timeCode:Number = event.data.timeCode;
// add event listener
mdm.COMPort.addEventListener("onCOMPortData", onDataHandler);

mdm.COMPort Class Example Downloads
No Example Downloads Available

Registered Users must be logged in to 'MyAccount' to add a Comment - Log In Here
  After Logging In, Click Here to Refresh This Page