I’m trying to upload an image from the web. I try locally and from the site, and always get a response: [IOErrorEvent type=“ioError” bubbles=true cancelable=false text="" errorID=0]
Code here:
private function loadImage():Void
{
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
/* way 1 */
//var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, SecurityDomain.currentDomain);
//_loader.load(new URLRequest("https://randomuser.me/api/portraits/men/79.jpg"), context);
/* way 2 */
_loader.load(new URLRequest("https://randomuser.me/api/portraits/men/79.jpg"));
}
private function loadCompleteHandler(event:Event):Void
{
trace("load complete");
}
private function ioErrorHandler(event:IOErrorEvent):Void
{
trace("load fail");
trace(event.toString());
}