im using the Loader object. only because i dont know any other way to do it in as3.
i had the idea that maybe i could see whether the framesLoaded was greater than the currentFrame of the swf. i supposed that if they were equal, that would mean the movie was stopped due to insufficient bandwidth, and if framesLoaded was greater, the movie ought to be playing.
so i went down that path and ran into some new snags.
firstly, the loader object doesnt really have framesloaded, only bytesLoaded, which is not as useful for what im looking to do.
secondly when i tried to access the loaded content to determine the currentFrame, i couldnt do that either. it seems you cant access the Loader.content timeline at all until the movie is fully loaded! that absolutely sucks if true. once you start the load, the swf starts playing... but that movie thats already begun to play is inaccessible (until it finished loading), as far as i can tell.
heres the code:
Code:
var ldr:Loader = new Loader();
var url:String = "loadtest-inner.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
function progressHandler(event:ProgressEvent):void {
MovieClip(ldr.content).stop();
//fails here!!
//(Cannot access a property or method of a null object reference.)
}
}
function completeHandler(event:Event):void {
MovieClip(ldr.content).stop();
//works here!!
}
ldr.load(urlReq);
myHolder.addChild(ldr);
in my test, until the load is 100% complete, ldr.content is equal to null. i cant stop the movie, or get the currentframe (using "MovieClip(ldr.content).currentFrame") without an error. so the problem seems to become more intractable the longer i look at it.
what im actually doing is trying to synchronize videos and flash movies that are loaded into a host movie. so theres an flv loading and an swf loading, i need to keep them both playing together (give or take a few frames). ive got silent streaming sounds in my swfs to insure a constant framerate there.
if the video pauses to buffer during loading i need to stop the flash movie, and vice versa. thats the reason i need to know whether the flash movie has stopped (got stuck on a frame) during the loading process. if youve any ideas of a different way to attack the problem, im all ears. or eyes.
waiting for the whole thing to load so it can play smoothly is out.
thanks!