Hello Can you load an external .swf into an empty movie clip and then advance the playhead so the loaded .swf starts on a frame other than frame one I've tried the following, but it doesn't work on(release) loadMovie("test.swf",emptyclip) emptyclip.gotoAndPlay(10) Anyone know if this can be done and what the code for it is Thanks so much Jake Lyma
emptyclip.gotoAndPlay(10) That's exactly how to do it, but you need to wait untill the .swf is fully loaded before it will work. To do this you will need to check _bytesloaded and _bytestotal. If they == then gotoAndPlay(10
Thanks Beally That makes perfect sense. The only thing I can't wrap my mind around is how to implement it. If I right an "if" statement and put the _bytesloaded==_bytestotal code in it, the .swf still might not be loaded and thus my gotoAndPlay(10) code would still be for naught. Do I also need to right some sort of function so that it keeps checking until it is fully loaded? If so, do you know the basics for that Thanks - and great site! How did you do the 3d plasma thing? Did you use a program other than flash Jake Lyma
Right; you'll need to create a loop that keeps checking. There are two ways that come to mind. One is more of a designer way, the other a developer way. First the dev way on(release) loadMovie("test.swf",emptyclip) _root.onEnterFrame = function(){ //this is a function that checks every frame, _root is where it placed(main timeline if(emptyclip._bytesloaded==emptyclip._bytestotal && emptyclip._currentframe<10) emptyclip.gotoAndPlay(10) delete _root.onEnterFrame; //delete the functio the only problem is i'm not the greatest developer and havent tried that, so it might not wor the other way would be to make a MovieClip(MC) that has two frames. frame 1:blank, frame 2 is an MC with the code onClipEvent(enterFrame){ if(emptyclip._bytesloaded==emptyclip._bytestotal && emptyclip._currentframe<10) emptyclip.gotoAndPlay(10) _parent.gotoAndStop(1) then on the button on(release) loadMovie("test.swf",emptyclip) _root.preloader_mc.gotoAndStop(2) So basically when it's time to load, the preloader_mc goes to frame 2 which has an MC that is constantly chwecking to see if its loaded, and once loaded and moved it goes back to frame 1, where the checking MC does not exist
Thanks so much Beally! Your answer is exactly what I needed. I haven't checked out the code yet to see if it works, but it makes perfect sense, so thanks.
Don't see what you're looking for? Try a search.
|