      */
     public function openStreamingConnection(appendToURL:String=null):void
     {
+        state = INIT_STATE;
         _appendToURL = appendToURL;
         
     	// Construct the streaming connection if needed.

            result += digit * powerOfSixteen;
        }
        return result;
    }
    
    /**
     *  Helper method to reset parser to initial state.
     */
    private function resetParserState():void
    {
        state = INIT_STATE;
        chunkBuffer = null;
        hexChunkSize = null;
        dataBytesToRead = -1;
        dataOffset = 0;
    }

    /**

     */
    public function closeStreamingConnection():void
    {
        state = CLOSED_STATE;
        chunkBuffer = null;
        hexChunkSize = null;
        dataBytesToRead = -1;
        dataOffset = 0;
        
    	// First, close the existing connection.
        if (streamingConnection != null)
