actionscript 3 - Serial communication with Arduino and serproxy to flash. Expected result just in test mode -
i have arduino 3 sensors connected. every 100ms arduino print new line on serial 3 updated values separated #:
ex.:
23#11#50_18_1_14_48_0_226_0_16_33_64_2_1_97_36_128_24_170 26#12#50_18_1_14_48_0_226_0_16_33_64_2_1_97_36_128_24_170 33#11#50_18_1_14_48_0_226_0_16_33_64_2_1_97_36_128_24_170 48#10#50_18_1_14_48_0_226_0_16_33_64_2_1_97_36_128_24_170
using serproxy pass values flash , as3 socket functions can trace serial output in test mode (ctrl+enter). @ point works expected.
when publish , run swf file can receive serial data not expected... every 100ms receive part of output. not same part , not full expected output receive in test mode.
could related security?
here flash code receive data:
var datasocket:socket = new socket("localhost",5333); datasocket.addeventlistener(progressevent.socket_data, socketdatahandler); function socketdatahandler(event:progressevent):void { var sensvalue:string; sensvalue = datasocket.readutfbytes(datasocket.bytesavailable); trace(sensvalue); var sensdata:array = sensvalue.split("#"); sensor1 = sensdata[0].tostring(); sensor2 = sensdata[1].tostring(); sensor3 = sensdata[2].tostring(); }
any ideas? thanks
you're running socket security errors bypassed when re using debug mode. depending on need do: (1) if want flash in browser need security http://help.adobe.com/en_us/as3/dev/ws5b3ccc516d4fbf351e63e3d118a9b90204-7c60.html (2) or if can use air instead, won't have deal of this.
Comments
Post a Comment