Adapt Kirupa Tutorial to show preload status

Hey, guys!

I am working on this tutorial http://www.kirupa.com/developer/mx/p...transition.htm

It teaches us how to make transitions between external swf´s in a really nice way. However, it does not display any preloading data when it loads an external swf, but a blinking “preloading” text. I am trying to adapt it so it will show the percentage loaded in a dynamic textfield.

Here is the original code:


onClipEvent (enterFrame) {
 if (!loaded && this._url != _root._url) {
  if (this.getBytesLoaded() == this.getBytesTotal()) {
   loaded = true;
   _root.transition.gotoAndPlay("opening");
  }
 }
}

And here is what I´ve got (not working):


onClipEvent (enterFrame) {
 var mclL:Object = new Object();
 mclL.onLoadInit = function() {
  percent.text = Math.round((this.getBytesLoaded()/this.getBytesTotal())*100)+"%";
 };
 this.addListener(mclL);
 if (!loaded && this._url != _root._url) {
  if (this.getBytesLoaded() == this.getBytesTotal()) {
   loaded = true;
   _root.transition.gotoAndPlay("opening");
  }
 }
}

Any help will be really welcome. Thanks in advance, guys!