Fade in Preloader
Sorry for more stupid questions but how do you make a preloader that fades in depending on how much the rest of the thing is loaded. You know, Alpha of image=Percent loaded.
My code currently is:
and I realise that my mistake is in the scaleY part but I'm not sure what to change it to. The rest of my code I got off the web/generally adapted and there aren't any errors, it just doesn't do what I want it to.
No other websites seem to show how to do it and I'm rubbish at making script so please help.
I'm not sure if this is the answer to your question.
Alpha is a number between 0 and 1, where 1 is fully visible and 0 is fully invisible.
If you take your numberLoaded/bytestoLoad, you'll get a fraction that, when multiplied by 100, will give you a percent.
Ex: 400/500 = 0.8. Multiply 0.8 times 100 = 80% loaded.
You can set your alpha to numberLoaded/bytestoLoad, and it will get progressively more visible until reaching an alpha of 1, or 100% loaded.
Your script currently tells the fill of the preloader to climb upward until it reaches 100%:
You could change it instead to say
sam is definitely on the right track.
but remeber, that if you want to fade OUT an image/movieclip according to the percentt loaded, you will want to SUBTRACT that number ( which is a fraction between 0 and 1) from 1, so if it has loaded 25% ( or .25), then it would be 1 - .25 = .75 or 75% visible
you can try this code to get a feel for what would happen
where 'myMovieClip' is an image/movieclip and
'myExternalSWF.swf' is the external swf you area loading in
if you are expecting a cross fade between the image fading out and the swf that is loading fading in, you will be disappointed, and will have to configure this code differently.
I'm not actually having it load a movie clip, I'm using it as the preloader for a flash website. Should I make the rest of the website in one Movie Clip instead? It would be annoying but I could do it.
Right, I've used your code and adjusted it to suit but there seems to be a problem.
It gives me error 1067 on the preLoader.load(Website) section and I realise that this is probably a really idiotic question but...
How do I fix this?
Seeing as no one seems to care about this any more but there are probably others asking the same questions as me...
I found a code that works on another website and I edited it slightly so it would work. For the others aout there as clueless as me:
Hate to be a sticky Tuesday, but that's the same code I gave you. The only difference is that I kept your original goal of modifying the fill of the preloader, whereas your new code modifies the alpha of the entire preloader. Subtle but distinct difference.