Error using a hyphen as an object property name in Flex
I'm trying to assemble a header object for an api request. One of the headers is 'Content-Type'开发者_如何转开发. The hyphen is causing a compile error. Flex is giving me:
1050 - Cannot assign to a non-reference value.
You can't have a hyphen (minus sign) in your variable name. For example, if you try to have a variable a-b = 3, Flex thinks you're talking about subtraction.
The documentation gives info about how to set headers:
var header:URLRequestHeader = new URLRequestHeader("Content-Type", "text/plain");
request.requestHeaders.push(header);
精彩评论