I have to look this up every single time, so I thought I would put it somewhere easy to find:
function submitData() {
var nRequest:URLRequest = new URLRequest('backend.php');
nRequest.method = URLRequestMethod.POST;
var dataObj:URLVariables = new URLVariables();
dataObj.someInfo = 'some information';
nRequest.data = dataObj;
var loader:URLLoader = new URLLoader(nRequest);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, onComplete);
loader.load(nRequest);
}
function onComplete(evnt:Event) {
var rVariables:URLVariables = new URLVariables(evnt.target.data);
trace(rVariables.someReturnedValue);
}
So in summary,
URLLoader --> URLRequest --> URLVariables
A diary about programming problems - to help me more easily learn from (and Google) past mistakes.
Monday, 12 July 2010
Friday, 2 July 2010
Events and Priorities
Just a note for future reference:
I tried using the priority parameter of a MouseEvent listener, to make the listener on the root get called before the listener within the movie clip, but it wouldn't work.
It was, however, able to distinguish between two listeners on the root timeline...
I tried using the priority parameter of a MouseEvent listener, to make the listener on the root get called before the listener within the movie clip, but it wouldn't work.
It was, however, able to distinguish between two listeners on the root timeline...
Subscribe to:
Posts (Atom)