Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

video preload in MX 2

Status
Not open for further replies.

archicad

Technical User
Jun 24, 2003
6
DE
... PLEASE bear with me on the explainations:

i am loading this swf into my main movie:

frame 1 has no content and a stop.

frame 2 the preloader:

ifFrameLoaded ("movie") {
gotoAndPlay (10);
}
("movie" being the first frame of the mov)

frame 8:

gotoAndPlay(2);
(the preloader repeating) ...

...and frame 10 then the content (the first frame of the mov). well, i imported and embedded the mov. flash told me the required frames needed and that works. my question now is:

the imported mov does not consist of individual frames (right? its this strip of the 1200 frames flash told me that are needed). so, when i preload until frame 10 is there, does that mean, its only one frame loaded of the mov, or does the first frame of the mov mean it is the whole thing??? meaning its loading the total file size because its that strip?

i read somewhere buffering 40% will assure good play back. so do i have to preload till frame 480 for this to happen? and in general, how big is TOO big of a video file? ... mine are 4mb, will stitching be better?

i know too many things at ones, but maybe someone can shed some light on some issues... or know some REALLY good tuts that even an eager, willing to learn newbie can understand!!!

thanx in advance
 
well search for video...then look for a loader...im sure there is one there somewhere



_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
First off, the ifFrameLoaded action is deprecated. You should use _framesloaded & _totalframes or getBytesLoaded() & and getBytesTotal instead.

Second, IMHO, you'd be better off using a preloader within your main movie, rather that one in the video.swf itself.

Preloaders can be built on a 1 frame (2 at most) movie clip. Any animation can be added in it's own movie clip, included in the 2 frame preloader clip.

You can have a look at such a preloader in this thread on FK:
Yes, you can have your movie play at what ever percentage already loaded you so desire. 40% may be enough on a fast connection, but definately not on a slow one. Only testing on a slow connection, what percentage would in fact allow the rest of your movie to download while already playing.

Finally, components are not a magic solution to everything, especially not in terms of preloaders.

Regards,

cubalibre2.gif
 
BIG THANX to everyones thoughts on this ...

especially oldnewbie ... seems you always have the right answers!!! well, for my problems at least ...

thanks for pointing out that the "ifFrameLoaded" action is deprecated. i looked at your preloader at flashkit, and its great. it works when i tested it with just one of my movies and keeping your main timeline.

... my main timeline has 4 buttons, one for the portfolio section. this loads a "sliding picture previewer", which has buttons for loading the projects itself. to make things easier for me (newbie thought), everything gets loaded in different levels. hence, i have to figure out how to put your preloader script to work with my "levels mess".

you mentioned its easy to adapt to levels. ... i will work on it more later, but if its an easy oneliner, feel free to drop me that line :) ... also, is it better to work with empty mc's in your opinion? might think of cleaning the levels mess?

still need to check out the file you fixed for the guy on flashkit. maybe some answers are there?

appreciate your thoughts and everyones help in this forum.

thanx

 
In the following preloader code, just replace wherever you see _root.containerMC by the level you are preloadingyour movie on... i.e. _level5, for example.

Code:
this.onEnterFrame=function(){
    //trace the percentage of the movie that has loaded
    percent=(_root.containerMC.getBytesLoaded()/_root.containerMC.getBytesTotal())*100;

	if(!isNan(percent)){
	// The following only concern the preloader's displays...
		if (percent == 0) {
			percent_display = "";
		} else {
			percent_display = Math.ceil(percent) + "% LOADED.";
		}
		this.loadbar._visible = true;
		this.loadbar._xscale = percent;
		if (percent > 1) {
			this.reelmc._visible = true;
		}
	// End of preloader's displays...
		_root.containerMC.stop();
	}
    if(percent == 100){
		// this sends this preloader clip back to frame 1
		// where it awaits the next call to it...
		this.gotoAndStop(1);
		// this deletes this onEnterFrame event...
		// so that the movie clip stops looping...
		delete this.onEnterFrame;
		// preloader's displays handling...
		this.reelmc._visible = false;
		percent_display = "";
		this.loadbar._visible = false;
		// end of preloader's displays handling...
		_root.containerMC.play();
		}
}
stop();

Thus...

Code:
this.onEnterFrame=function(){
    //trace the percentage of the movie that has loaded
    percent=(_level5.getBytesLoaded()/_level5.getBytesTotal())*100;

	if(!isNan(percent)){
	// The following only concern the preloader's displays...
		if (percent == 0) {
			percent_display = "";
		} else {
			percent_display = Math.ceil(percent) + "% LOADED.";
		}
		this.loadbar._visible = true;
		this.loadbar._xscale = percent;
		if (percent > 1) {
			this.reelmc._visible = true;
		}
	// End of preloader's displays...
		_level5.stop();
	}
    if(percent == 100){
		// this sends this preloader clip back to frame 1
		// where it awaits the next call to it...
		this.gotoAndStop(1);
		// this deletes this onEnterFrame event...
		// so that the movie clip stops looping...
		delete this.onEnterFrame;
		// preloader's displays handling...
		this.reelmc._visible = false;
		percent_display = "";
		this.loadbar._visible = false;
		// end of preloader's displays handling...
		_level5.play();
		}
}
stop();

Of course, you would also have to change your loadMovie action on your button...

From...
Code:
_level0.containerMC.loadMovie("[URL unfurl="true"]http://blake.prohosting.com/~tektips/flash/felix1.swf");[/URL]

To...
Code:
loadMovieNum("[URL unfurl="true"]http://blake.prohosting.com/~tektips/flash/felix1.swf,[/URL] 5");

Watch out for bad linebreaks, here on the forum. Better to edit the .fla you downloaded.

Regards,

cubalibre2.gif
 
... it wasnt a oneliner :) but without you pointing out everything, i probably would have forgotten to change some of the levels. so thanx again for sharing your script and taking the time to be so discriptive and helpful.

i had one more thing to bug about, but when i just phrased the question ... i answered it myself, way to go! so now parts of the site are working thanx to your help. will be happy to post the link as soon as its done.

before that, i am sure something else will popup. great to know where to find awesome help.

cant thank you enough :)
 
hi, me again ... with a general movie import question:

the mov is 1.6 mb after "squeezing". i looked up a couple of tuts like ...

and applied my settings: quality 80, keyframe interval 24 and scale 100. now the file is 5 mb and i am wondering why flash blows it up. with a setting of quality 100 it was 34 mb.

is their another magic trick to the file size jungle.

thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top