Loading FlashPaper


Got another one. Man, flash is tricky, ain’t it?

Here, goes: I need to load in various flashPaper documents onto my stage. Not at one time, more like load one, have the user browse through, he clicks on a button, loads in another flashPaper swf into the same clip. Or maybe i should removeMovieClip and then createEmptyMovieClip, set it’s size and load my content into the new one. I dunno. All i know is one way or the other i seem to be hhavin problems scaling flashPaper. It loads in at 550x400 constantly.

Closest thing i got is this code i found on macromedia.com (adobe now, right).

function loadFlashPaper(
   path_s,   // path of SWF to load
   dest_mc,  // MC which we should replace with the SWF
   width_i,  // new size of the dest MC
   height_i, // new size of the dest MC
   loaded_o) // optional: object to be notified that loading is complete
   var intervalID = 0;
   var loadFunc = function()
      dest_mc._visible = false;
      var fp = dest_mc.getIFlashPaper();
      if (!fp)
      if (fp.setSize(width_i, height_i) == false)
      dest_mc._visible = true;
   intervalID = setInterval(loadFunc, 100);

bt1.onRelease = function(){

It almost works fine. For some reason, if i click my button, load in my swf, it scales properly, everything is fine untill i click on the button again, then there seems to be some loop in the code (don’t see it) everything slows down i get a warning from flashPlayer about a looped script sometimes and if i don’t the swf loads in again at100% spilling out from my layout. Wow, that’s a long sentence.

So, can You see the problem with the above code.