开发者

What would cause Flash (AS3) to substitute in & for & in GET query params?

I've spent a day on this so far and just can't figure it out. The problem is that Flash is apparently substituting & for & in my GET query params.

So for example, I'm sending into a URLLoader a URLRequest with a url similar to this:

http://foo.blah.com/app/index.php?abc=def&ghi=jkl&mno=pqr

I verified this by looking at the var in the debugger. Yet it's failing on our server. Ethereal reports that what is actually going over the wire is this:

GET /app/index.php?abc=def&ghi=jkl&mno=pqr

Not the first, but the second & is being replaced with &.

I can't figure out how to make it stop doing this. What could cause this? Or does anyone have any id开发者_如何学运维eas of things I can investigate?


Use the data property to construct the passed GET variables (you will have to set the request method to GET as well, check out the AS3 documentation for more granular information).

example :

var getVars:URLVariables = new URLVariables();
getVars.abc = "def";
getVars.ghi = "jkl";

var request:URLRequest = new URLRequest();
request.data = getVars;

urlLoader.load(request);


Ugh. Ok, thanks to Theo (who I'll give credit for the answer because I didn't know about URLVariables) I went and checked every possible thing that could be wrong.

The real problem was that I do indeed have & in the original URL request. I was doing a string.replace() that of course only hits the first instance.

The problem was that in the debugger, Flash apparently helpfully converts & back to &! So I didn't see the bug. Thanks Flash!

If I had done a trace() on the output just to be sure (which I thought I had but I clearly hadn't) then I would have noticed this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜