|
-
the idea of time
Hello,
I am wondering about how flash sites load. I create linear sound/image flash pieces and I usually have a preloader so the sounds and .jpg's sync, but the piece I'm currently working on has about ten 600k video clips and I don't want to have the viewer wait for everything to download before the piece plays.
The effect I'd like to create is that each video clip appears only when a vister rolls over it so that the 600k movies only appear one at a time and according to the viewer's mouse actions. My first thought was that by creating a really wide html page and by placing the ten clips in a long line with each as a seperate .swf with it's own preloader onto the page, instead of having one large .swf with a preloader for the whole thing I could outwit time -ie. the shortest .swf would download and then play while the longer ones that were out of sight could be loading. The more I got to thinking about it though, the more I feared that rather than downloading things in a linear fashion like I want the viewer to experience the piece, actually everything would download simultaneously so that the total amount of bytes to load would slow everything down. Is this true?
Then I thought instead maybe I could work within flash to create a staggered download by using an action script like the loadMovie command. For instance, as a viewer enters frame 1 that contains the first clip there could be a stop action and a loadMovie command to begin loading the second clip which would be on frame 2. Then when they finished looking at the clip on frame 1 and went on to frame 2 that clip would be loaded and a new loadMovie action would trigger the third clip to load etc... Can the .swf's that get loaded with the loadMovie command have preloaders? and will a preloader at the beginning of the whole piece not take into account those .swf files that are to load with the loadMovie command?
Or am I going about this all wrong? Can I design a preloader to load only 50% of the total bytes and then have the rest download in a linear fashion according to the .swf's timeline? Or can I somehow use levels so that each video clip resides on a different level and then write an action where each of the levels loads successively?
I have avoided having the clips stream because I want to control the quality of the clips and also have them appear without the quicktime player. Can someone who isn't as time impaired as me help me figure out how I can have a preloader that loads the first 600k and then while each of the following 600k clips plays the next one is loading, or something of the kind?
thanks,
llyfre
-
Hi,
I think you would need to use two Levels or empty Movie Clip holders. One that was being viewed and the other being loaded into. Similar to the buffer switching method used in early graphics programming. You toggle between them using ._visible=true; ._visible=false;
Just have a function that loads the Movie Clips this function can easily control what should be loading and what should be visible.
This way you have one central piece of loading script rather than preloading script scattered all over the place.
You will need to consider the case in which a viewer is viewing a loaded Movie then decides to view the next one BUT it is not loaded yet. I would suggest that if this happens some sort of progress bar appears to show them at what stage the load is. They would then have to wait for it to finish loading.
If you think this sounds OK give me some idea of what your Main Movie will be ie: navigation by buttons to next clip?? And will the Main Movie need a preloader too.
I can put an example together for you pretty fast.
One important thing what Version of Flash do you use and for what platform??
Shipstern
-
Shipstern,
Thanks for your message. What you've written sounds good, but I'm not all too clear on how to implement it...
What I've got is a 250 kb sound intro with a simple graphic title followed by a number of invisible buttons that work to trigger sounds on and off and to move the navigation along to usher in the video clips, one at a time. I'm thinking there will never be more than one clip at a time viewable, and there will be sound activated between clips that could potentially keep a viewer entertained if the next clip in line isn't fully loaded. A loader bar would be fine, I just don't know how to get it to work. I currently have the video clips imported as .swf files into my .fla library and then I load them into empty movie clips. I haven't been able to figure out how to get a preloader to work for the intro without getting stuck on all the video clips to follow or how to get the video clips that follow to have their own preloaders. I've tried putting a preloader on the .swf of each clip which works fine until I bring it into the project I would like them to exist within, and also to put a preloader in the empty movie clip the .swf's are to laod into, but with no luck when I go to preview the project.
I'm working with Flash MX on a OSX mac, though I view things from windows98 also so I'd like it to work across platforms - it's a swampy world out there though...
Any help would be duly appreciated,
llyfre
-
Hi llyfre,
Ok I have a better idea of what your set up is. So.
First your inro with the sound and graphics will obviously not have a preloader but rather just stream.
When you load your external.swf Movies you "could" have them all load into individual Levels or holders but I think that 6 MB sitting in RAM is a lot. So You could just use two holders one for loading and one for viewing. This way 2 X 600 is only 1.2MB in RAM.
So with two holders (I think this is better than using Levels) I would have a function which loads in your external clips when your buttons are pressed.
All your external.swf files will need Frame 1 to be empty except a stop(); action to stop them streaming.(so all the content for your external.swfs start on Frame 2).
The following script (goes on your main movie timeline Frame 1) uses 2 empty Movie Clip instances named "buffer0" and "buffer1" to hold your external.swfs And a function to do the loading and swap between what the viewer wants to see and what is loading. There are lots of comments for you.(also see NOTE
Code:
//start with your preloader bar invisible until needed
preloaderBar._visible=false;
//create your empty Movie Clip instances
this.createEmptyMovieClip("buffer0",1);
this.createEmptyMovieClip("buffer1",2);
//flag variable so we know which Level is currently visible.
visibleBuffer=2;
//flag variable so we know which Level is currently loading.
loadingBuffer=3;
//function to do the loading
function loadTheMovie(thePath){
//show your preloader bar
preloaderBar._visible=true;
//start loading external .swf into the currently hidden buffer
this["buffer"+loadingBuffer].loadMovie(thePath);
//now we run a loop to check if its loaded
this.onEnterFrame=function(){
//get the bytes loaded and bytes total
BL=this["buffer"+loadingBuffer].getBytesLoaded();
BT=this["buffer"+loadingBuffer].getBytesTotal();
//check if the .swf is loaded
if(BL >= BT && BL >0){
//your .swf is now loaded
//so hide your loaderBar
preloaderBar._visible=false;
//switch your buffers to make the hidden buffer
//visible and the visible buffer hidden
this["buffer"+visibleBuffer].gotoAndStop(1);
this["buffer"+loadingBuffer].gotoAndplay(2);
//switch the variables
tempBuffer=visibleBuffer;
visibleBuffer=loadingBuffer;
loadingBuffer=tempBuffer;
//stop the loop which was checking the bytes loaded
delete this.onEnterFrame;
}
//scale your preloader bar while its still loading
preloaderBar._xscale=(BL/BT)*100;
}
}
NOTES: You would use this with your buttons by placing a call to the function in your button events ie:
on(release){
loadTheMovie("theSwfYouWantToLoad.swf");
}
The preloader bar is just a Movie Clip with the instance name "preloaderBar" it has a simple rectangle graphics in it.
Thats it ... you "may" need more functionality but this is the foundation to build on.
Hope this helps any questions just post back.
Shipstern
-
Shipstern,
Thanks for the speedy reply...
I expect it will take me a bit to get this into action but your layout looks beautiful. I'll keep touch as I progress and expect to really be able to sit down and woodshed early next week. Until then,
llyfre
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|