PDA

View Full Version : Error Message: NetDebugger


LostInRecursion
09-16-2004, 06:34 PM
Does anyone know what this means in the NetDebugger?

"Unsupported type found in stream"

I called a CFC and passed the data property in my Shared Object, lsoUserInformation - It seemed to work fine in the previous build, all of a sudden it doesn't. Any ideas?

-K

jimrobson
02-01-2005, 01:49 PM
I got the same error, and I was unable to find an answer on the Web. I searched Macromedia's site, and found nothing. A Google search found only this posting. So, now that I have found the cause of the error, I figured I'd post the solution in case it helps anyone else. Here goes:

In the cffunction, I have a cfargument which specifies that type="numeric". So far so good.

In Flash, the value that was being passed for this argument was a derived value. I have a function called "dollarClean()" that takes a textfield as a parameter, and returns the value entered in the textfield minus the currency symbol and commas. For example, if dollars_txt is a text field, and dollars_txt.text = "$45,000.25", then dollarClean(dollars_txt) would return 45000.25. Looks like a number, right? Well, it isn't. It's a string. So when I passed this as the value of the argument, I got the error "Unsupported type found in stream" (not exactly a helpful message under the circumstances).

The fix, of course, is extremely simple. I just pass the value to the Number() constructor, and pass this to the cfc. Here it is in long-hand:

// Pass the textfield to the function to clean up non-numeric characters.
// This returns a string.
var strAmount = dollarClean(dollars_txt);

// If "service_cfc.doSomething()" is a cffunction in
// a cfc that expects a numeric value, this call
// returns the "Unsupported Type..." error:
service_cfc.doSomething(strAmount);

// So... Pass the string to the Number constructor.
// This returns a numeric value:
var numAmount = Number(strAmount);

// This works without the error
service_cfc.doSomething(numAmount);