Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Hearty Preloader Goodness; Reducing waiting (loading) time
Topic Started: Apr 5 2006, 08:37 AM (256 Views)
akpaintslinger
Member Avatar
Brackenwood Heavyweight
Hello everyone! :bfoot:

I've already checked the resources and macromedia exchange in regards to this subject, but to no avail. :(
I'm currently working on a inventory displayer that is around 400kb on average. And for viewers without cable or DSL, it'd take awhile for it to load.

The link for an example is right here in case any of you'd like to take a look for reference.

So for the past few days I've been searching for a method to reduce waiting time without reducing quality. Here is an example of what I had in mind--- it's just an image gallery that loads each picture as you click on its thumbnail.

How would I go about building these sorts of loaders and what code is needed?

Any help or advice would be much appreciated.

Thanks. :)
Offline Profile Quote Post Goto Top
 
Jemooky
Member Avatar
Matt
I forgot the technicalities, but I can give you a rough idea of what Justin at Cartoon Smart does. You need to create a swf for each you want to load, with the jpeg file inside the swf. Place these image swfs in the same directory as your main swf.

To load the images into your Primary swf, use "loadMovie".


That's about all the detail I can give you, but I hope it's enough information to put you on the right track.
Offline Profile Quote Post Goto Top
 
juggleballz
Member Avatar
I'm loose, full of juice and ready for use!
ur basically looking to load in different parts of the movie when needed, rather than it all loading at once?

Like Matt said u just need to load in the external movieclips.

Make all ur different sections in separate swf files.

So say u have 4 swfs.
1.Ur Main swf, into which the others will load
2.Section one.swf (with preloader included)
3.Section Twoswf (with preloader included)
4.SectionThree.swf (with preloader included)

SO say u have a button that loads in SectionTwo.swf, and it replaces the entire Main swf, u need to place this code on the button:

Code:
 

on (release) {
if(this == Number(this)){
 _root.loadMovieNum("SectionTwo.swf",this);
} else {
 _root.loadMovie("SectionTwo.swf");
}
}
}


or u can add the code to a frame, so a section loads in when a frame is reached in ur main timeline:

Code:
 

if(this == Number(this)){
 _root.loadMovieNum("SectionTwo.swf",this);
} else {
 _root.loadMovie("SectionTwo.swf");
}
}


Now, you if u notice the word "_root" above, what that means is that the entire Main swf will be replaced with the loaded movieclip. If u want a section to load into a specific area in ur Main swf u will need to set up an invisible Movieclip to act as a stage to which the external movieclip will be loaded.

so u have a button an u want ur small external section to load into a specifc area in ur main swf, that area being indicated by an empty Movieclip that u have created.

Give the empty movieclip an instance name such as "loadarea"

U want ur button to load in sectionTwo.swf to that area, without replacing everything, add this code to the button:

Code:
 
on (release) {
if(this.loadarea == Number(this.loadarea)){
 loadMovieNum("SectionTwo.swf",this.loadarea);
} else {
 this.loadarea.loadMovie("SectionTwo.swf");
}


}


the ".loadarea" indicates where the external movieclip will be loaded into.

hope this helps ;)

Oh and make sure all ur swfs are in the same folder. ;)
Offline Profile Quote Post Goto Top
 
akpaintslinger
Member Avatar
Brackenwood Heavyweight
Matt, Juggleballz, you two are the best!

Thanks! :bfoot:
Offline Profile Quote Post Goto Top
 
akpaintslinger
Member Avatar
Brackenwood Heavyweight
New relevant topic:

I just installed a preloader using Vector's basic tutorial. (I use MX '04)
Fixed the lowercase 'm' to 'M' and that solved the undefined problem.

I want movie to play as usual once the loading finishes, so I put play(); at the end.

The problem now is that once it loads, the timeline begins plowing from start to finish, and disregards all other actionscript keyframes along the way. (buttons still work)

This is the code on the preloader frame:
Code:
 
stop();
butPlay._visible = false;

_root.onEnterFrame = function() {
Percent = getBytesLoaded() / getBytesTotal() * 100;
Progress._xscale = Percent;
dtPercent.text = Math.round(Percent) + '%';
if (getBytesLoaded() == getBytesTotal()) {
play();
}
}


Were there any other changes made to MX '04 actionscript that would effect this code? :++:
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
Putting "stop();" on the frames you want it to stop on doesn't work?
Offline Profile Quote Post Goto Top
 
akpaintslinger
Member Avatar
Brackenwood Heavyweight
Exactly. :huh:

It just keeps on trucking right through them.
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
Ah, the onEnterFrame isn't getting deleted. That code continues to run every frame... And since the movie is loaded, "play();" runs evey frame. Deleting the onEnterFrame once it's loaded should fix it.


Code:
 

if (getBytesLoaded() == getBytesTotal()) {
play();
delete(_root.onEnterFrame);
}
Offline Profile Quote Post Goto Top
 
akpaintslinger
Member Avatar
Brackenwood Heavyweight
Ay, that's the rub. :)

Thanks, Mr. Jiggmin!
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply