From 25d48696ee462a91f84a7db5e69cfec2e9ae35ec Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 14 Jun 2007 22:23:43 +0000 Subject: [PATCH] Update masking behavior: configure the mask to be the lesser of the maximum size and the actual SWF frame size in each dimensions. This may break some avatars that were smaller than full size but drawing a little outside their bounds to the right or bottom. Probably nobody was actually depending on this bug.. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@265 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flash/MediaContainer.as | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/as/com/threerings/flash/MediaContainer.as b/src/as/com/threerings/flash/MediaContainer.as index e4595588..b789455e 100644 --- a/src/as/com/threerings/flash/MediaContainer.as +++ b/src/as/com/threerings/flash/MediaContainer.as @@ -209,12 +209,6 @@ public class MediaContainer extends Sprite info.addEventListener(IOErrorEvent.IO_ERROR, loadError); info.addEventListener(ProgressEvent.PROGRESS, loadProgress); - // create a mask to prevent the media from drawing out of bounds - if (getMaxContentWidth() < int.MAX_VALUE && - getMaxContentHeight() < int.MAX_VALUE) { - configureMask(getMaxContentWidth(), getMaxContentHeight()); - } - // start it loading, add it as a child loader.load(new URLRequest(url), getContext(url)); addChildAt(loader, 0); @@ -591,11 +585,18 @@ public class MediaContainer extends Sprite } /** - * Called when we know the true size of the content. + * Called when we know the true size of the content. Subclasses may override and use this + * opportunity to do their thing, too. */ protected function contentDimensionsUpdated () :void { - // nada, by default + // update the mask + var maxW :int = getMaxContentWidth(); + var maxH :int = getMaxContentHeight(); + if ((maxW < int.MAX_VALUE) && (maxH < int.MAX_VALUE)) { + // if we should do masking, then mask to the lesser of maximum and actual size + configureMask(Math.min(maxW, _w), Math.min(maxH, _h)); + } } /**