kaikai0428

Same URL will load twice?

Recommended Posts

Hello,

 

If i write the same URL request but different name

 

like this:

<MP3Loader name="a_mp3" url="a.mp3"  autoPlay="false" />

<MP3Loader name="b_mp3" url="a.mp3"  autoPlay="false" /> 

 

it will load twice? or the second loader will use the cache?

Share this post


Link to post
Share on other sites

If the browser has it in its cache, it should load it from there instead of pinging the server again. Is that what you're asking? 

Share this post


Link to post
Share on other sites

hey jack,

 

sorry my English is not very well,

 

the first question is,

 

if the browser doesn't has it in cache in the first time,

 

for example:
 

<MP3Loader name="a_mp3" url="a.mp3"  autoPlay="false" />

<MP3Loader name="b_mp3" url="a.mp3"  autoPlay="false" /> 

 

After it finish the first loading ("a_mp3")

 

now the browser will has it in its cache,

 

after that, everyone who want to load the same URL but use the different name

 

it won't load "a.mp3" twice but use from the cache right?

 

and the other question is,

 

if i use LoaderMax.getLoader("b_mp3") to get the Mp3Loader, it will target the same instance of LoaderMax.getLoader("a_mp3") or they are different instance?

 

thanks for answer!

Share this post


Link to post
Share on other sites

getLoader() will return the first instance it finds that has that URL. 

 

And yes, if the file is already in the browser's cache and the user tries to load it again, the browser should use the cache (although technically that's up to the browser). 

  • Like 1

Share this post


Link to post
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.