Hello, my question is simple: How to use JSON.decode in AS extension?
I tried to import JSON, but it was unsuccessful, and I tried to google the solution but I haven't find anything.
So, I have a json text, how can i decode it to use it in the response?
JSON.decode in extension
Re: JSON.decode in extension
Hi,
I am not sure I fully understand. Can you please specify which SFS version you're using?
Also are you loading the JSON from a file?
Back to your question, JSON support is included in AS3 since Flash Player 11:
http://help.adobe.com/en_US/FlashPlatfo ... /JSON.html
cheers
I am not sure I fully understand. Can you please specify which SFS version you're using?
Also are you loading the JSON from a file?
Back to your question, JSON support is included in AS3 since Flash Player 11:
http://help.adobe.com/en_US/FlashPlatfo ... /JSON.html
cheers
Re: JSON.decode in extension
I'm using sfs pro.
I want to load json file from url, in an extension that was written in AS.
How to do this?
I want to load json file from url, in an extension that was written in AS.
How to do this?
Re: JSON.decode in extension
You could use the LoadVars class:
http://smartfoxserver.com/docs/1x/docPa ... /index.htm
(see under left menu, under "Other methods")
This emulates the LoadVars used in Flash and requires variables to be passed as a query string. In other words your webpage should return the JSON like this:
If the web server returns pure JSON output then this won't work and you will have to integrate a java library to perform the HTTP call.
My suggestion is to use this:
http://hc.apache.org/httpclient-3.x/
Hope it helps
http://smartfoxserver.com/docs/1x/docPa ... /index.htm
(see under left menu, under "Other methods")
This emulates the LoadVars used in Flash and requires variables to be passed as a query string. In other words your webpage should return the JSON like this:
Code: Select all
json={ .... }&otherParam=123&nextParam=abc
If the web server returns pure JSON output then this won't work and you will have to integrate a java library to perform the HTTP call.
My suggestion is to use this:
http://hc.apache.org/httpclient-3.x/
Hope it helps
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 31 guests