This is a simple preloader document where im loading an swf file called Target.swf into a clip called ContainerMC.

PHP Code:
PreloaderMC.TXT=0;

loadMovie("target.swf","ContainerMC");

this.onEnterFrame=function(){
    
trace("ENTERFRAME");
    
BytesLoaded=ContainerMC.getBytesLoaded();
    
FileSize=ContainerMC.getBytesTotal();
    
PreloaderMC.TXT=Math.round((BytesLoaded/FileSize)*100);trace(PreloaderMC.TXT);
    if (
PreloaderMC.TXT==100) {
        
trace("YES");
        
//delete this.onEnterFrame;
    
};
}; 
The onEnterFrame(); checks for the amount of file loaded etc as usual and everything works prefect.

Except for the last statement delete this.onEnterFrame; which is why ive deactivated it by commenting it.

As long as its commented everything works ok. But the minute i uncomment it and it comes into action nothing runs properly.

But i also need it to work there as thats the standard way to kill the onEnterFrame loop and also maybe add an extra statement to remove the PreloaderMC as otherwise theres a huge "100%" standing in the middle of the screen. But the last statement never works. It prevents the entire preloader from running. But trace shows YES and keeps on tracing YES and 100 repeatedly.

There are only 2 clips on the root timeline on a single frame. ContainerMC and PreloaderMC (inside which there a dynamic text whose variable etc ive correctly given as the preloader text refreshes correctly with percent loaded).

The delete this.onEnterFrame wreaks havoc.

Can someone point me to what statement i should use or if my logic in the loop is wrong.

Thanks