Preloader not working with Library/Linkage..?

  • torbjorn
  • Novice
  • Novice
  • User avatar
  • Posts: 23

Post 3+ Months Ago

Greetings Flash-heads,
I am using a preloader that has worked well in the past, on small file sizes and flash sites that have a long animated entry, where things appear over a long period of time. My latest site has everything appearing on frame three, no animated entry.
But for this new site I have a lot of sounds and objects loaded onto the stage from the LIBRARY via LINKAGE. When I test the Movie, the Bandwidth Profiler suggests almost a third of the site is appearing on the first frame, from the LIBRARY. In the time line and on the main stage, there is virtually nothing on the first frame.
So, my preloader doesn't seem to appear until 75% of the site has loaded. It isn't starting at 0% like it should. It's behaving as if I had a lot of content on frame 1, but I don't. I can only assume it's because of the Linage-loaded items. How do I tell my preloader to include the LIBRARY loaded elements ??

(Preloader Movie Clip sits on Frame 1 of _root with this code on it)
Code: [ Select ]
onClipEvent (enterFrame) {
    percx = bar._x;
    perc = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100);
    xperc = perc/100;
    barlength = 200;
    if ((perc == 100) and (bar._x >=barlength)) {
        prealph = _root.preloader._alpha;
        setProperty(_root.preloader, _alpha, prealph-10);
    } else {
        bar.nperc = perc+"%";
        bar._x = barlength*xperc;
    }
    if (prealph<0) {
        with (_root) {
            gotoAndPlay("start");
        }
    }
}
  1. onClipEvent (enterFrame) {
  2.     percx = bar._x;
  3.     perc = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100);
  4.     xperc = perc/100;
  5.     barlength = 200;
  6.     if ((perc == 100) and (bar._x >=barlength)) {
  7.         prealph = _root.preloader._alpha;
  8.         setProperty(_root.preloader, _alpha, prealph-10);
  9.     } else {
  10.         bar.nperc = perc+"%";
  11.         bar._x = barlength*xperc;
  12.     }
  13.     if (prealph<0) {
  14.         with (_root) {
  15.             gotoAndPlay("start");
  16.         }
  17.     }
  18. }
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

When you dynamically call clips from the library, they can only be displayed if they are fully loaded. So when you set the Linkage properties to "Export for Actionscript" you will notice that the "Export to First Frame" open gets auto-checked. This is required because Flash will then export these items to the imaginary Frame 0, so they will load before all content and be assured they are able to load.

What I recommend doing in this case:

Create a blank keyframe right after your preloader (but have it before your actual movie starts as well). In this frame take the clips from your library and drag an instance of them onto the stage. So I see you start your movie on a frame with the label "start"... so your setup would most likely be...

frame 1 = preloader
frame 2 = junk frame for dynamic library clips
frame 3 = start frame

I may be wrong, im assuming, but thats the basic jist of the setup.

So ANYWHO... what this will do is allow your preloader to actually preload the clips since they already exist on the stage, thus allowing you to uncheck the "Export to First Frame" option in the linkage settings. And since you skip over this frame when the movie is done preloading, you don't have to worry about the clips getting in the way.
  • torbjorn
  • Novice
  • Novice
  • User avatar
  • Posts: 23

Post 3+ Months Ago

Thanks Lostinbeta,
It is a strange workaround but it helped significantly. Your suggestion caused the preloader to appear and kick in at around 24% loaded, (Better than 75%!!) I had actually tried unchecking the "load in first frame" box, but it had caused problems, as things would not load in time, or at all.
The bandwidth profiler now suggests that the brunt of the site's content is on frames 1, 2 and 3.
Thnx a ton,
t
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

No problem, glad I could help :)

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.