[flashpro] AS2 Preloader - - Help Needed...
Matthew Zoern
mzoern at sympatico.ca
Fri Sep 30 18:05:19 EDT 2005
Hey Fes,
If you want your preloader to fade in then out you need to set it up in
a movie clip. You have a transition in on the loader. The loader
activates and when you've reached your desired percent loaded you fade
back out.
There is a couple ways you can fade this back out. You can set up a
function to set back frame by frame to the beginning of the clip. In
essence faking the transition back out.
The other way is simply doing the same fading in. then fading the clips
out using the timeline.
I'm not sure the best way to do this using AS2.0, but I'll put this out
and see if anyone has any modifications or better ways of doing it.
// Code begins here
this.onEnterFrame = function(){
maxBarWidth = statusBarMain_mc._width;
// reads the size of the document and divides it by what has been loaded
percentloaded = _root.getBytesLoaded() / _root.getBytesTotal() * 100;
display_txt.text = Math.round ( percentloaded ) + "%";
// the width of the bar is set based on the "percentloaded" variable
currentBarWidth = percentloaded;
statusBarMain_mc.bar_mc._width = (currentBarWidth / 100) * maxBarWidth;
// checks to see if the swf is 100% loaded
if (percentloaded >= 100) {
_root.gotoAndStop("start");
delete this.onEnterFrame;
}
}
// Code ends here
matthew
On 30-Sep-05, at 2:53 PM, Fes Hudson wrote:
> Hello, I was wondering if anyone could point me to a
> good tutorial, explain the process, show me some code,
> basically anything or whatever may help me to achieve
> the type of preloader I am trying to build.
> Obviously, there are plenty of tutorials on building
> preloaders out there, but most of them use older
> techniques. What I want to accomplish is to build a
> preloader using AS2 (since that is what I have been
> learning, and I have also read that there is a
> signifigant difference in the process if you are using
> AS2 classes in your site) for the initial loading of
> my site and then another one for the loading of
> external swfs from within the website and possibly
> basing it off of the MovieClipLoader class and it's
> methods since it has a lot of built in functionality
> for this sort of thing. I would like to know if anyone
> could help me figure out the best, and most
> professional way of constructing reusable preloaders
> in this way. Another key desire of mine for the
> preloaders, and one that I haven't been able to find a
> single tutorial or forum post online that has been
> helpful, is to have the preloader "animate in" BEFORE
> it starts preloading, and then "animate out" AFTER the
> load is complete, but BEFORE the content is visible.
> I'm sure you guys know exactly the type of thing I am
> describing, I just have never done this before and
> need a little help the first time so I can get it
> right. I appreciate any help that anyone is willing to
> offer...thanks! - Fes
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
> ------------------------------------------------------------------
> send message to the list: mailto:flashpro at muinar.org
> [FlashPro] list info, subscribe, archive: http://flash-list.com/
> There's also a WebPro mailing list: http://webdesign-list.com/
> cutting-edge sounds for flash: http://flash-sounds.com/
>
More information about the FlashPro
mailing list