There are two movies, one on the computer (projector), and one on the internet (simple movie).
How can the projector know when the movie has loaded in to it?
This is very important, please help me...
Printable View
There are two movies, one on the computer (projector), and one on the internet (simple movie).
How can the projector know when the movie has loaded in to it?
This is very important, please help me...
I've never tried on a projector, but it should be the same as with embedded swf movies.
Unfortunatelly the onLoad event has a strange behaviour.
In this case it's totally useless (it's not like the variables.onLoad event...).
Anyway, you issue is quite simple!
I'll try to make it tasty:
let's say that you are loading a movieclip into a target, with the "loadMovie" command (this code should be in the frame actions):
buttonMC.onPress = function() {
loadMovie("myLoadedMovie.swf", loaderMC);
};
ok, you should make a loop that continously checks for the loaderMC to be fully loaded with the myLoadedMovie.swf....
this can be done with the onEnterFrame event (remember not to assign actions to the loaderMC, as when you load a new MC on it they will be erased!)
try this: (place this code where you placed the previous);
loaded = false;
this.onEnterFrame = function() {
if(loaderMC.getBytesLoaded() == loaderMC.getBytesTotal() ?? loader.getBytesTotal() >= 1000 && !loaded) {
trace("download completed!"); //place your code here
loaded = true;
}
};
let's analize what happens..
the code is a kind of (id's say graphic) loop, as it's looped at every frame update (the speed depends on what refresh rate you set the document to - in the document properties).
There is an IF instruction that will prevent the movie from executing the code before you have actually loaded the movie you want to load from the web.
Actually there are three different arguments in the IF instruction:
--- the loaded movie (actually the loaded movie target, so the loaderMC) loaded value has to be identical to the total value (in Bytes);
--- the loader movie value has to be over 1Kb (this will prevent flash from evaluating the loaderMC as it's self as an interesting object...we want it to wait for the real thing to start loading);
--- the "!loaded" argument stand for "if(loaded==false)":
this is just another dispatcher, which can help you drive a movie with multiple movies to load on the same target.
tell me if you want a quick sample file...
hope this helps!
Imma sorry....I just wrote it badly....Quote:
Originally posted by keyone.it
loaded = false;
this.onEnterFrame = function() {
if(loaderMC.getBytesLoaded() == loaderMC.getBytesTotal() ?? loader.getBytesTotal() >= 1000 && !loaded) {
trace("download completed!"); //place your code here
loaded = true;
}
};
this is the right one:
loaded = false;
this.onEnterFrame = function() {
if(loaderMC.getBytesLoaded() == loaderMC.getBytesTotal() && loader.getBytesTotal() >= 1000 && !loaded) {
trace("download completed!"); //place your code here
loaded = true;
}
};
I have a bit of a problem with that - My movie that is to be loaded is only 90 Bytes...
Then I'll try doing this:
...loader.getBytesTotal() == 90...
Because I'm sure it's exactly 90 bytes
Well I'm trying it, but it doesn't work...
If you can, a quick sample file?
loaded = false;
this.onEnterFrame = function() {
if(loaderMC.getBytesLoaded() == loaderMC.getBytesTotal() && loader.getBytesTotal() >= 40 && !loaded) {
trace("download completed!"); //place your code here
loaded = true;
}
};
this should work without problems...
(always put a value that is more that 4 bytes......that's plenty enough if you create an empty loaderMc)
cheers!