lon-io / tinkerit

Automatically exported from code.google.com/p/tinkerit
0 stars 0 forks source link

Cant send data from Flash right after connect #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you send data from Flash to TinkerProxy in the onConnect handler, then the 
data does not make it to the Arduino.

Im not sure if this is a Flash or TinkerProxy issue.

For example:

private function onConnect(event:Event):void
{
     _socket.writeByte(1);
}

Wont make it to the Arduino.

The workaround is the wait two seconds after connect before you send data.

private function onConnect( event:Event ):void
{
    trace( "onConnect" );

    if(!connectDelayTimer)
    {
        connectDelayTimer = new Timer(2000);
        connectDelayTimer.addEventListener(TimerEvent.TIMER, onConnectDelayTimer);
    }

    connectDelayTimer.start();

}

private function onConnectDelayTimer(event:TimerEvent):void
{
    trace("onConnectDelayTimer");
    connectDelayTimer.stop();
        _socket.writeByte(1);
}

Again, Im not sure if this is a Flash or TinkerProxy issue, but wanted to post 
it here in case it is a TinkerProxy issue, and in case anyone else runs into it.

Btw, I tested this in Adobe AIR, and not in the Flash Player in the browser.

Original issue reported on code.google.com by mikechambers on 1 Aug 2010 at 5:55

GoogleCodeExporter commented 8 years ago
Just to add one note, I tried setting the delay to less than two seconds, but 
it wouldnt work with anything less than 2 seconds.

Original comment by mikechambers on 1 Aug 2010 at 5:56

GoogleCodeExporter commented 8 years ago
I spoke with the player team about this, and this is a Flash Player issue, and 
not tinkerproxy. You can close this.

Original comment by mikechambers on 2 Aug 2010 at 5:59