all groups > flash (macromedia) > february 2005 >
You're in the

flash (macromedia)

group:

gotoAndPlay after loadMovie



gotoAndPlay after loadMovie danivi
2/2/2005 10:49:55 PM
flash (macromedia): I need to make a gotoAndPlay after I load a movie with LoadMovie
this.createEmptyMovieClip('tester_mc', 1); tester_mc.loadMovie('photo.swf');
function checkLoaded(target_mc:MovieClip) { var pctLoaded:Number =
target_mc.getBytesLoaded()/target_mc.getBytesTotal()*100; if
(!isNaN(pctLoaded) && (pctLoaded>0)) { target_mc.onLoad = doOnLoad;
clearInterval(myInterval); } } var myInterval:Number =
setInterval(checkLoaded, 100, tester_mc); function doOnLoad() {
//trace('movie loaded'); tester_mc.gotoAndStop('rotated'); } but is not
working. what am i doing wrong? Thanks in advance Daniel Caracas, Venezuela
Re: gotoAndPlay after loadMovie danivi
2/3/2005 1:23:47 AM
Thanks for your help, but still don't get it. As I undertand, the function is
called only when the bytesloaded are iqual to the bytesTotal, that means that
the movie is completed loaded, am I right?, then the I made the
tester_mc.gotoAndStop('rotated'); I tried what you suggested, but with no luck.
thanks again
Re: gotoAndPlay after loadMovie Jeckyl
2/3/2005 9:56:25 AM
First I have to reformat your message so I can reed it .. damned MM forum
software (grrrr)

[quoted text, click to view]
this.createEmptyMovieClip('tester_mc', 1);
tester_mc.loadMovie('photo.swf');
function checkLoaded(target_mc:MovieClip) {
var pctLoaded:Number =
target_mc.getBytesLoaded()/target_mc.getBytesTotal()*100;
if (!isNaN(pctLoaded) && (pctLoaded>0)) {
target_mc.onLoad = doOnLoad;
clearInterval(myInterval);
}
}
var myInterval:Number = setInterval(checkLoaded, 100, tester_mc);
function doOnLoad() {
//trace('movie loaded');
tester_mc.gotoAndStop('rotated');
}
[quoted text, click to view]

Problem is you do your doOnLoad as soon as even 0.001 percent of the movie
it loaded. But a gotoAndStop won't do anything until the frame you are
going to is loaded. So you really should wait until (say) 100% of the movie
is loaded (not just >0) before trying to gotoAndStop anything.

--
All the best,
Jeckyl

Re: gotoAndPlay after loadMovie Jeckyl
2/3/2005 2:12:28 PM
[quoted text, click to view]

no .. you've written it so it is called when bytes loaded > 0 .. you want to
check for percentage being >=100, not for being >0

AddThis Social Bookmark Button