# as2:CS2-help! Find last frame of loaded swf that loads flv file

**URL:** <https://forum.kirupa.com/t/as2-cs2-help-find-last-frame-of-loaded-swf-that-loads-flv-file/276895>\
**Category:** flash\
**Created:** [December 4, 2008, 7:32pm UTC](https://forum.kirupa.com/t/as2-cs2-help-find-last-frame-of-loaded-swf-that-loads-flv-file/276895 "2008-12-04T19:32:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkmin](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jkmin](https://forum.kirupa.com/u/jkmin)\
**Post date:** [December 4, 2008, 7:32pm UTC](https://forum.kirupa.com/t/as2-cs2-help-find-last-frame-of-loaded-swf-that-loads-flv-file/276895/1 "2008-12-04T19:32:25Z")

</div>

How do you detect the end of the loaded swf that loads the flv?  
It never reaches the frame 20, and I think it is due to the loaded flv CamTest.flv file. So how do you find out that the loaded swf really reached the end? How do you find out the end of the loaded flv inside the loaded swf? Thank you very much

On mainline frame 1, I have  
loader\_mc.loadMovie(“CamTest\_controller.swf”);

On the loader\_mc movie clip

onClipEvent (enterFrame) {  
if (\_root.loader\_mc.\_currentframe == \_root.loader\_mc.\_totalframes && \_root.loader\_mc.\_currentframe\>5) {  
myTimer = \_global.setTimeout(gotoNextFrame, 5000);  
}  
trace(‘cur frame=’+\_root.loader\_mc.\_currentframe+’ total frame=’+\_root.loader\_mc.\_totalframes);

```
function gotoNextFrame() {
    if (_root.loader_mc._currentframe == _root.loader_mc._totalframes) {
        _root.gotoAndStop(2);
    }
}

```

}

onClipEvent (load) {  
trace(“on load clip event”);  
for (obj in \_root.loader\_mc) {  
trace(“Type:”+typeof (\_root.loader\_mc[obj]));  
trace(“Name:”+\_root.loader\_mc[obj].\_name);  
}  
trace(‘cur frame=’+\_root.loader\_mc.\_currentframe+’ total frame= '+\_root.loader\_mc.\_totalframes);  
}

The output trace file has the following.

on load clip event  
cur frame=1 total frame= 1  
cur frame=1 total frame=1  
cur frame=0 total frame=0  
on load clip event  
Type:function  
Name:undefined  
Type:movieclip  
Name:background  
cur frame=1 total frame= 20  
cur frame=1 total frame=20  
cur frame=2 total frame=20  
cur frame=5 total frame=20  
cur frame=11 total frame=20  
cur frame=12 total frame=20  
cur frame=13 total frame=20  
cur frame=14 total frame=20  
cur frame=15 total frame=20  
undefined  
m\_fLastFrameTime : 220.493076923077  
TOCStyleManager.styleTree called  
100  
100  
loadFileRequest w/ a NULL fileIndex  
\*\*\*\*\*\*\*\*\*\*\*\*\*loading Files: 0 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
loadFiles: CamTest.flv  
loadFiles: CamTest\_PIP.flv  
First run: true

**fileLoadFinished called** \*\*\*  
cur frame=16 total frame=20  
cur frame=16 total frame=20  
cur frame=16 total frame=20  
cur frame=16 total frame=20  
cur frame=16 total frame=20

…  
cur frame=16 total frame=20
