0 Replies Latest reply on Jul 3, 2006 12:51 AM by byenary

    Is this a good way to center images of all sizes?

    byenary
      myMCL.onLoadInit = function (targetMC)
      {
      var scaleratio;
      if (targetMC._width > Stage.width){
      scaleratio = targetMC._width / Stage.width;
      targetMC._width = Stage.width;
      trace("Scaleratio : " + scaleratio);
      targetMC._height = targetMC._height/scaleratio;
      }
      if (targetMC._height > Stage.height){
      scaleratio = targetMC._height / Stage.height;
      targetMC._height = Stage.height;
      targetMC._width = targetMC._width/scaleratio;
      }
      targetMC._x = (Stage.width-targetMC._width)/2;
      targetMC._y = (Stage.height-targetMC._height)/2;

      }