MovieClip.prototype Question

Im making one site and wanna create one prototype that load and do tween of alpha zero to alpha 100. Bellow my code:


//_________________________________________
//                                                     prototype
MovieClip.prototype.loading = function(file:String):Void {
    this.loadMovie(file);
    onEnterFrame = function() {
        var lfilet:Number = Math.round(this.getBytesTotal());
        var lfilel:Number = Math.round(this.getBytesLoaded());
        var lfilep:Number = int((lfilel/lfilet)*100);
        if ( lfilet > 4 && lfilep == 100 ) {
            this.alphaTo(100,1);
            delete onEnterFrame;
        } else {
            this._alpha = 0;
        };
    };
};
//_______________________________________
//                                                     usingIt
var perfBg:String = xml.childNodes[0].childNodes[0].attributes.bg;
conteudo.perfil.bg.foto.loading("imagens/" + perfBg);

After run it the image load normaly but dont show the fade. studing the code results i saw that error is the load variables (lfilet, lfilet and lfilep), the result of lfilet and lfilel always is the same. what can i do to resolve it or with this code create one classe ( i dont know nothing about develop classes, only how to use ).

tks in advance and waiting help.
:stuck_out_tongue: