开发者

Error using a hyphen as an object property name in Flex

开发者 https://www.devze.com 2022-12-23 13:44 出处:网络
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:

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号