var task: HttpRequestTask = new HttpRequestTask(); task.url = “https://foobaz.com/myapi”; task.done(function(taskReturned:HttpRequestTask):void{ trace(“task is the same and taskReturned: “ + task == taskReturned);// you get the task back in the done callback trace(task.status);// will be either AsyncTask.COMPLETE, AsyncTask.FAILED or AsyncTask.CANCELED if(task.completed){ trace(task.httpResult); trace(task.httpStatus); } else if(task.failed){// it failed you can get the status to know why trace(task.httpStatus); } else { // The only other possibility is it was canceled if(task.status == AsyncTask.CANCELED){ trace("your task was canceled in the middle!"); } else { throw new Error("This should be impossible. Tasks either complete or fail"); } } }); // you need to run it or nothing happens... task.run();
> On Dec 2, 2021, at 11:10 AM, Maria Jose Esteve <mjest...@iest.com> wrote: > > Hello, > @Harb, is there an example of how to use AsyncTask? I would like to > experiment with it, I think I can use it in some of the projects and then > include it in the examples project that I maintain [1] > > [1] https://github.com/mjesteve/royale-examples-community > > Hiedra. >