Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
AdrianaBaron

What happens if unload is never called?

Recommended Posts

As im new to this loading and preloading I always load load load but never unload... what is the consequence of this? is there some best practices around loading and preloading?

 

thanks

Link to comment
Share on other sites

Well, if you keep loading and never unload, the only risk is that memory usage could get pretty high (which in some cases could lead to performance degradation). If you're loading a lot and then don't need the loaded assets at some point, it would definitely be considered a best practice to unload() it.

Link to comment
Share on other sites

Ok i'll see when should i unload... as in my application i dont know where the user will go until it goes there and its a must to present the user the view as soon as he/she enters on it, so im preloading upfront...

 

I dont know if u know what i mean...

 

Have u ever had to do something similar? what would u recommend? is there an option for the loader to recognize when something loaded already has not been visited for a certain period of time and then unload it?...

 

Another question is... do you have an example of a video player for the video loader? i would greatly appreciate it...

 

Thank you

Link to comment
Share on other sites

Have u ever had to do something similar? what would u recommend? is there an option for the loader to recognize when something loaded already has not been visited for a certain period of time and then unload it?...

 

No, that's something you should manage. It would be inappropriate for LoaderMax to do that sort of thing for you since every app is different. If you need access to the various assets at anytime and you're not running into memory problems, you're probably fine not unloading them.

 

Another question is... do you have an example of a video player for the video loader? i would greatly appreciate it...

Keep an eye on http://active.tutsplus.com - I believe that next Thursday there will be a brand new tutorial on EXACTLY that (building a video player based on VideoLoader).

Link to comment
Share on other sites

  • 2 weeks later...

Hi I have a question with the Video Loader

 

I have a Loader Max into another Laoder Max which contains a VideoLoader...

 

When I get the Video Loader from all the load of the LoaderMax which its in, I would like to change properties such as the height and width but any option I give like using videoLoader.vars.width: 700 It doesnt accept it.. I had to preset those values at the creation of the Video Loader like on the vars, but I would like to change it later on for some otre values as I have like a factory of VideoLoaders and some videos will maybe need to have different dimensions... Hope you understand this question ;) I mean hope I made myself clear.... I couldnt get it working :( I'd appreciate it :)

Link to comment
Share on other sites

Sure, you can set those values anytime directly on the ContentDisplay object. Use the special "fitWidth" and "fitHeight" properties like:

 

var loader:VideoLoader = LoaderMax.getLoader("myVideoLoaderNameOrURL");
loader.content.fitWidth = 400;
loader.content.fitHeight = 300;

 

Does that answer your question?

 

The reason it doesn't work by setting the vars properties AFTER the VideoLoader is already created is that...the ContentDisplay is already created :)

 

Make sure you are using the latest version (early versions of ContentDisplay didn't have fitWidth/fitHeight properties). http://www.LoaderMax.com

Link to comment
Share on other sites

  • 2 weeks later...

Thank you I will try this!!! now I have a question I have like an MP3 Asset which I load on a LoaderMax using a Mp3Loader and then I get that MP3 loader and ask it to play, now if I do this play twice in different parts of the application I cannot get it to play :| dont know what would this be but if I lest say Load the same asset but with a different name it then works... its like if with the same name that doesnt work... but with different names it does... Is it maybe that when its played you need to rewind it to play again? or something?

 

As usual I'd appreciate your reply :) thank you!!!

Link to comment
Share on other sites

Yes, each time you playSound() it simply continues - if you want it to start from the beginning each time, use gotoSoundTime(0, true). And if you want to have multiple instances of that sound playing simultaneously, you'd need to create separate MP3Loaders. You should never name two loaders the same thing, though - how could LoaderMax.getLoader() find it by name if there are two (or more) with the same name?

 

Does that answer your question?

Link to comment
Share on other sites

Yes thank youuuuu I think this Loader is the best!!! and not only because the code is brilliant but because the support is fantastic!!! :P

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.
×