Jump to content
Search Community

Loading PNG files that are without a file extension

creatify test
Moderator Tag

Recommended Posts

Before I dig too deep, I'm hoping someone can direct me on how to modify LoaderMax to allow it to load PNG files that happen to not have the file extension .png.

 

The files are under our control and are of the known type PNG, however, for various reasons, the file names do not contain a file extension in their names.

 

Thanks!

Link to comment
Share on other sites

Are you saying you don't want to use ImageLoader and instead you want to tap into the LoaderMax.parse() method to automatically identify the loader type that should be used based on the file's extension, but you aren't using a file extension?

 

Have you already tried just using an ImageLoader? Is that not possible in your setup?

Link to comment
Share on other sites

Thanks for the response! I'm batch loading these files using the technique below and I have activated the image loader:

 

 

loadimgs = LoaderMax.parse(imgURLs, {name:"imgBitmapsLoader", onProgress:loadMaxImgProgress, onComplete:loadMaxImgComplete, onError:loadMaxImgError}) as LoaderMax;

loadimgs.maxConnections = imgURLs.length;

loadimgs.load();

 

But, within the LoaderMax parse method, due to there not being a last instance of "." in the URLs, in fact, there will never be a period within any of the URLs, the URL itself is trying to be validated against the _extensions objects.

 

I did hack in a quick solution, but I feel it's less than ideal — so was wondering if there is a better way to handle this.

 

I activated (again, not ideal) an empty string as a file type:

LoaderMax.registerFileType("", ImageLoader);

 

And within the parse method, I simply set 's' to an empty string if the URL doesn't contain a period.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...