I’m trying to load an image from an external URL other than the project address (html5).
In HTML5 it does not return an error. It just doesn’t run the project. In NEKO, this message appears:
Uncaught exception - [lime.utils.Assets] ERROR: There is no asset library named “https”
I’ve tried to change the asset tag, and put the https:… address instead, but it doesn’t accept.
It looks like you’re attempting to load a remote image using Assets.getBitmapData or Assets.loadBitmapData. That only works for assets included with your application.
BitmapData.loadFromFile("https://www.someurl.com/my_image.png").onComplete( someCallback );
function someCallback(bmpd:BitmapData):Void {
///add your code to display the bitmap here
}
var url = "https://www.example.com/image.jpg";
var urlRequest = new URLRequest(url);
var loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
loader.load(urlRequest);
addChild(loader);
function loader_complete(event:Event):Void {
trace("complete");
}