AS2 :: Post JSON Data From Flash With The JSON As The Body Of The Request?

Nov 5, 2010

I'm working on a Flash AS2 application that needs to post JSON data to a web service.In previous projects, I've used LoadVars.send() or LoadVars.sendAndLoad() successfully to manage this:

var send_lv:LoadVars = new LoadVars();
send_lv.data = JSON.stringify({some json object});
var response_lv:LoadVars = new LoadVars();
response_lv.onData = function(rawdata) {

[code]....

In somepage.php, I can grab that JSON data using $_POST['data'].However, on this project, the developer of the web service requires the JSON content to be the BODY of the request (i.e., not a name/value pair). Is this possible with LoadVars?

View 1 Replies


Similar Posts:


ActionScript 1/2 :: "POST" JSON Data In The Body Of A Request With LoadVars?

Mar 10, 2009

Is it possible to "POST" JSON data in the body of a request with LoadVars? I understand LoadVars sends data as name>value pairs. How can I send the data in the body instead?

View 1 Replies

Actionscript 3.0 :: Json : How To Post JSON Data

Dec 13, 2011

I have to work with webservices in Actionscript. I found the following code that allows me to use JSON URLs that implement only the GET method. However, it doesn't work for POST methods (doesn't even enter the "onComplete" method). How can i "POST" JSON data using Actionscript 3.0?

package
{
import flash.display.Sprite;
import flash.net.URLRequest;

[code]....

View 1 Replies

Json :: Unable To Encode Flex Grid Data Into JSON On Sorting Columns?

Nov 28, 2011

Created an editable flex grid which exposes a method called getGridData() to javascript. I am using the JSON.encode() method of the [url]....library to convert the grid object's dataProvider into JSON before returning it.

ExternalInterface.addCallback("getGridData", getGridData);
public function getGridData():String
{[code].....

However, when I sort a column in the user interface, the encode method is failing throwing the following error

Property usingCustomCompareFunction not found on mx.collections.SortField and there is no default value.

View 1 Replies

Actionscript 3 :: Json : Parsing JSON Data?

Sep 28, 2011

I am sending a request to a server, and in return I get a long block of JSON.

{
"response":"success",
"assignments":{
"17733":{
"asnid":"17733",

[code]....

Is there a way to do this? I checked if the property was enumerated and it returned true, but I cant find a way to access this data.

View 1 Replies

Flex :: Access Data Field Of A JSON Request Send By Client In JAX-RS?

Feb 2, 2012

I have the following JAX-RS service.[code]...

The JAX-RS service receives the request and respond successfully with some dummy response, but I have no access to the request.data field.

How do I access the data of the request message (which is {"type":"get_configuration","data":"some data"} in this particular example)? I think that I'm supposed to add some parameters to the handleMessage method like

public SomeResponse handleMessage(Object message) {...

but this does not work at all. The request got 415 response.

View 1 Replies

Flex :: Send HTTP POST Request With Binary Data In Body

Sep 17, 2009

I'm new to Flex and couldn't figure out yet how to send binary data to the server as the body of a POST request. The HTTPService component doesn't seem to support this. The FileReference doesn't seem to support setting the data via the Flex API.

View 4 Replies

AS2 :: Json - Add A Request Header To A LoadVars When Using GET (Flash)?

Oct 29, 2010

I'm working on a project built in Flash AS2.One of the things I need to do is load JSON data. In the past, I've had no problem with this - LoadVars works just fine.However, on this project, the JSON service that I'm calling requires the http request to include an ACCEPT header with "application/json".

LoadVars has an addRequestHeader method that allows me to add or change HTTP request headers, but according to the documentation, those headers are only sent with POST actions.Of course, in my case, the JSON service only allows GET requests.I tried using addRequestHeader anyway, but the header is not sent.(Of course, I could rebuild the application using AS3, which allows me to use URLLoader and URLRequest, but the application has WAY to much legacy AS2 code...)

View 1 Replies

Actionscript 3 :: Json - Decode JSON - JSONParseError: Unexpected H Encountered

Oct 14, 2011

I'm new to JSON. This is the .json I want to decode but I always get this error:

[Code]...

View 1 Replies

Actionscript 3 :: Json - Counting Elements In JSON Array Which Is In An Object

Feb 23, 2012

I have a pure ActionScript 3 problem, but the simplified test case I've prepared is in Flex 4 for better visibility (the source code is below): Since Flash Player 11 / AIR 3 support JSON natively, I've decided to move a multiplayer game, which used XML for communicating with server, to JSON. But I have a frustrating problem, that given two Objects like

[Code]...

View 1 Replies

ActionScript 3.0 :: Json - Use A JSON API In Flash?

Jan 15, 2012

I was wondering if someone could explain or point me in the direction of how to implement an API that uses JSON in ActionScript 3.0. What I specifically want to know is how would I grab specific information. The following is how I do it in XML but I don't know how I would do something similar in JSON as in getting the equivalent of an XML tag. For example with the twitter API I'd like to grab the text [URL]

[Code]....

View 1 Replies

Php :: Json_decode - Malformed JSON From AJAX Request?

Oct 3, 2011

I am building a request in Flash that contains a JSON encoded Array of Objects. This is encoded using as3corelib. The request is then passed to JavaScript via ExternalInterface and a jquery ajax call sends the request off to the server.In PHP, the incoming data is parsed, but the json_decode returns null, giving a Malformed JSON error. var_dump results in comments:

<?php
(isset($_POST['gdata']) && !empty($_POST['gdata'])) ? $gamedata = $_POST['gdata'] : returnError("game data not specified");
var_dump($gamedata);[code]............

What I don't understand is that attempting to decode the variable returns null, but the same text decoded from a literal string works fine. What can I do to clean up the incoming data and make it readable for json_decode?

Edit: php_info() says that magic_quotes_gpc is enabled. Could that be the issue?

View 1 Replies

Actionscript 3 :: POST JSON Using Adobe Flex?

Mar 19, 2012

I'm trying to POST some JSON data using Adobe Flex but having some problems. I'm now getting the error message "A URL must be specified with useProxy set to false", even though I do have useProxy set to false.

Update : code below is now working.

[Code]...

View 1 Replies

ActionScript 1/2 :: Send HTTP Request And Get The Response In JSON Format?

Aug 10, 2009

I am using ActionScript 2.0 for my app development. I have checked XML and LoadVars class. These classes by default send/receive data either in XML or name/value pair format. I want to send data in JSON format and receive the response in JSON format. How can I achieve this behavior using AS2.0. I have noticed that AS3.0 has the capabilities to do so. My client platform doesn't support AS3.0.

View 3 Replies

Xml :: Getting Static Data For Flash App With JSON?

Jul 9, 2010

I've flash app and i've static data (like ~18.0KB) for it which aren't changed often so I was wondering how to better get them. The static data may be in XML or JSON. One of my ideas was to put the static data in .js file within a function which would return them in JSON list and the other one was to return them in XML (as I like to work with XML more in Flash) somehow. But I'm not sure if it possible to put XML stuff in JS file to return them when function is called.. Or is XML pages also cached in browser and I will get the same performance result which I would get with cached JS files?

View 1 Replies

Json :: Get The Twitter Api Trends Data Into Flash?

Jan 21, 2012

I know how to get json data into flash with twitter's search api because the array names normally aren't weird, but I'm not really too experienced with json. For the trends api data, I'm not sure how to access it because the array name is the date and theres spaces and colons in it, and I'm not really sure what to do. Normally in flash to get the json data I'd do something like

json.trends[0].2012-01-21 01:20.name

but that doesn't work. Can someone tell me how to pull out the name data when the array name is the date. I apologize if I'm calling these things the wrong name, I'm not too sure on what their proper names are. [URL]

View 3 Replies

Flash :: Obtain And Push JSON Data Into Arrays?

Sep 13, 2010

so I have a JSON link that contains a couple of nodes (not sure what you call them in JSON) that I need to put into arrays in ActionScript, but I'm still having trouble trying to trace out all the specific node content.I found a similar question here, but the fix just showed how to trace out the entire JSON file (which shows up in my output window as [object Object],[object Object],[object Object],...)first node: {"captions":[{"content":"[hello world] ","startTime":0,"duration":4000}

My code:

private function onCaptionsComplete( event:Event ):void
{
//var jsonObj:Object = JSON.decode(event.target.data);[code].....

captions: undefined

TypeError: Error #1010: A term is undefined and has no properties.What I would like to be able to do is put the content data into the captionsContent Array, and the startingTime into a startingTime Array, same with the duration data.

View 1 Replies

Encode Data And Pass It To A Php File Using JSON And Flash?

Nov 29, 2010

Can any one provide me with an example of how to encode data and pass it to a php file using JSON and flash?

View 1 Replies

Actionscript 3 :: Corelib Can't Decode JSON String With JSON.decode()?

Sep 9, 2011

I am working on an inDesign Extension in flex where I am encoding an object to JSON and then later trying to create an object from the JSON String.

The Class I am encoding with JSOD.encode()
public class ManualProductLink {
private var _productID:String;

[code].....

View 1 Replies

Actionscript 3 :: Decoding JSON Data From PHP?

Apr 28, 2011

I am able to pull JSON data from PHP into my Flex application just fine with the following bit of code:

[Code]...

View 2 Replies

Php :: Load JSON Data With URL Loader?

Aug 4, 2011

I am new to action script 3.0. o understand how can I load data with URLLoader.So, I have an aplication like:

var PATH:String = "http://www.somesite.com/myFirstPage.php?a=10&b=20";
var urlRequest:URLRequest = new URLRequest(PATH);
var urlLoader:URLLoader = new URLLoader();

[code].....

View 4 Replies

ActionScript 2.0 :: Pull Data From JSON In It?

Jul 10, 2009

I am currently designing a set of actionscript charts for my company's website. For the set of charts I have set up right now I'm reading all the data from FlashVars, but as you could guess that's not a very good format for charts...

I'd prefer to use a JSON array of values,

now my question is: Where should I go to start learning about reading from JSON is AS2? I'll hit the books, of course, but this forum is always good when I need to get some advice to dive right in to an urgent project

View 1 Replies

ActionScript 2.0 :: Loading Data From JSON

Jul 13, 2009

does anybody have any experience with using the JSON class from JSON.org to load JSON data into Actionscript 2?

View 0 Replies

ActionScript 3.0 :: Use JSON To Get Some Data From Server?

Jan 23, 2010

I am new at ActionScript. I'm trying to use it with Flare visualization package, but truth is, I don't know what is due to my ignorance of Flare or my ignorance of ActionScript. I am trying to use JSON to get some data from my server. Near as I can tell the data are arriving properly at my ActionScript, but then I get lost.

public function buildGraph(num:int) : Data {
var dataata = new Data();
var nodes:Array = new Array(num);

[code]....

So, it must have gotten something from my server. What I want is to get the nodes from the nodes list and edges from the edges list, which is also in the json package. The server (running Python / TurboGears 2.0) returns

return dict(nodes = nodeList, edges=edgeList)

nodeList, in turn, is a list of dictionaries of the form: dict(id="node"+"%03d" % n).I tried ds.nodes, ds.nodes.data, ds.nodes.valueOf, etc. What am I missing?

View 0 Replies

Php :: Reading RAW Data From A Flash POST Request ( Images )?

Dec 8, 2009

I'm basically interacting with a third party API flash file to send HTTP POST requests to my server. know I'm on somewhat the right path because it requires a crossdomain.xml file, and before I added that part nothing in the POST variables was showing up, however since I added that file there are 4 variables that are set, these POST variables are sent by the application to give me basic information about the file.. but I actually need to read the RAW POST data to actually save the image being sent by the Flash.I'm aware there are 3 ways...$GLOBALS['HTTP_RAW_POST_DATA'] $HTTP_RAW_POST_DATA which is probably the same as the firstfile_get_contents('php://input')For whatever reason, neither of these "work". By "work" I mean they're not being set, when I var dump them I get nothing.

Could it be that there's a setting in php.ini that I need to set, or perhaps the Flash application is truly not sending the actual image? I think it's doing the right thing, because it's a semi popular API and it's used by a couple other sites so I'm pretty sure it's right on their end.

View 1 Replies

ActionScript 3.0 :: Read Json Data From A Web Service?

Mar 17, 2011

I'm trying to read json data from a web service. The problem is that it seems URLLoader always return the data as XML so I can't decode the json string.
 
This is my code :
 
import com.adobe.serialization.json.JSON;
var myRequest:URLRequest = new URLRequest(<asmx, web service path>);
myRequest.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();

[code]....

not surprisingly i get an error on the json decode because as far as i can see using trace, i get xml data.Also i tried to run it on the browser, didn't help. Also tried to set the content type in the request to 'application/json', but it gave me an error.Even though i googled it, i couldn't fint what is the problem in my as3 code. It seems to me it should have worked.

View 3 Replies

ActionScript 3.0 :: Load JSON Data From Another Server?

Sep 10, 2010

I'm trying to load JSON data from another server.

It works when I test i Flash - but in Browser it doesn't work.

Is there something I have to change before publishing?

ActionScript Code: import com.adobe.serialization.json.JSON  /*Path to the JSON class (in JSON.as). NOTE: make sure to keep all the classes in the original json folder together and that at the very beginning of each class file in the json folder, the file path after the word 'package' accurately reflects that path to the FOLDER in which all the classes are located. E.g. package [URL]

/*Create the objects you need*/
var loader:URLLoader = new URLLoader() ;
var request:URLRequest = new URLRequest() ;
/*Connect to and load the data within the numbers.php file*/

[Code].....

View 4 Replies

ActionScript 3.0 :: Save Data In JSON File?

Jun 18, 2011

I have a table which contains 3 columns, "itemid, xcordinate, ycordinate", in this different records are saved, now i want to have these records on a JSON file, when use click save button, all records present in the table(2d array) save in JSON file.

View 1 Replies

ActionScript 2.0 :: Getting Json Data With A Useragent From Server

Sep 24, 2011

sendInfo = new LoadVars();
sendInfo.addRequestHeader("User-Agent", "myagent");
sendInfo.onLoad = function()
{
trace(sendInfo.loaded):
};
sendInfo.load("url");//for getting JSON data

My Result is false and the firefox browser is still loading data from server. how to use useragent in actionscript2 and also how to get json data. I don't know is it json data problem or another

View 2 Replies

Media Server :: Retrieve JSON Data In Asc File?

Dec 22, 2011

In an asc file, I am trying to retrieve some data from a server that uses JSON as its exchange format each time someone connects to a specific application. ( I can't control the exchange format)To do that I send a POST using the sendAndLoad method of a LoadVars ObjectSo far I only managed to get the HTTP header. The target object from the sendAndLoad method seems to be empty .he response format from the server is like this :{"result":{"uid":"24947431041778945007157724608309","sid":"20825068196 030559827758762683967"} (I got it by doing a POST with cURL)ince the data doesn't have the attribute=value&attribute2=value2..."format, I think I will not be able to get themoes anyone know if it is possible to first get and then parse these data using either ServerSide ActionScript's API

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved