I’ve put a preloader on frame 1 of a movie. The code’s fine but it doesn’t seem to kick in soon enough. When I look at the streaming and the frame by frame graph illustrating an analysis of the loading, it shows I have 37kb on frame 1 and about 2kb on frame 2. Yet only my preloader is on frame 1 and everything else is on frame 2. The preloader bar only shows when about 95% of the movie is loaded.
The preloader works fine with just a large bitmap on frame 2 so its not the preloader.
Is it the fact that the ‘everything else’ on frame 2 is in fact actionscript which builds the stage from the library using attachMovieclip at runtime? The stage on framed 2 contains only an empty movieclip to which library items are attached.
Any ideas as to what is happening would be greatly appreciated.
2 solutions: [list][]you export in the first frame, and then you load the movie in an empty container movie that will do the preloading[]you don’t export in the first frame, but you have to put instances of the clips you want to attach somewhere, because you can’t attach a symbol that has never been on the scene[/list]pom
Best preloaders are done on scene1 and have movie guts on scene 2 especially if you use the getBytesLoaded function.
that way you can still have some interesting things to entertain them while they wait.
Lucky you somebody answered! And lucky me, because I asked the same a week ago and had no response. Sure I did not explain my question propperly, I guess.
Anyway, I,m glad I’m not the only one with this problem. I was beggining to think my flash software was playing fool to me!
Oh and
you export in the first frame, and then you load the movie in an empty container movie that will do the preloading
I also don’t get it. I mean, i know what you talk about when speaking about the empty container, but, what do u mean with [COLOR=crimson]export[/COLOR] in the first frame???
i encounter the same problem. and i see some people out there too when i notice some sites that had a preloader but as i expected, it didnt [COLOR=red]kick[/COLOR] in soon enough.
right, been playing about, think i’m getting it now. please correct me if i’m wrong…
the items in the library which are attached via actionscript at runtime have to have their ‘linkage’ property set. when you set the linkage in the symbol properties panal, flash also ticks the bottom option, export in first frame.
this means that even though all the code for attaching the movieclips is on frame 2 (with the preloader on frame 1) flash does all the linkage exporting stuff on frame 1. hence the preloaded doesn’t kick in until that is loaded and done.
ilyaslamasse, i now understand what you mean. either
a) get another movie to load it all. so nest it a way, and get a preloader to load the nested movie.
or
b) untick the ‘export on first frame box’ and stick instances of the library items to be attached on the stage on frame 2. aesthically unpleasing but hey, it would do the job.
not actually had time to get any of this to work yet but seems along the right lines.
i’ll be honest, can’t get the ■■■■ thing to work. what i had in mind was the following
creat a new movie and put the following code on frame 1:
loadMovie(“bigbigfile.swf”,container);
var myInterval;
myInterval = setInterval(preload,10);// calls the function preload ever 10 milliseconds
function preload(){
var bytes = container.getBytesTotal();
var bytes_loaded = container.getBytesLoaded();
//trace(bytes);
//trace(bytes_loaded);
if (bytes_loaded == bytes) {
clearInterval( myInterval );
bar._visible = false;
}
bar._xscale = bytes_loaded/bytes*100
}
where ‘container’ is an empty mc and ‘bigbigfile.swf’ is the file to be loaded in, oh, and ‘bar’ is just a movieclip in the shape of a long rectangular bar movieclip.
trouble is it doesn’t really work ( you can see the me trying to ‘trace’ certain properties)
if you’ve any ideas, i’d be gratefull. the only preloader problems i can see on sites like this are the trivial ones. can’t believe i/ew are the onlt ines with the problem. might give that illasm… ,whatever his name, is an email. if i get anything i’ll let you know.
Thank u Mr X. I’ll give it a try when i find the time. I guess i will be able to get it. If someone does first let us know :trout:
Now i have a suggestion, for those who dare in writting tuts
Seems like this topic is very common, at least lately i have read a lot of posts about it… anyone to write a tut???