From 1eef72d9da2b53f6666c0b19d839498b75decdf5 Mon Sep 17 00:00:00 2001 From: Robert Zubeck Date: Mon, 9 Apr 2007 23:31:22 +0000 Subject: [PATCH] Adding a mask and changing some colors inside the ScrollBox. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@191 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flex/ScrollBox.as | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/as/com/threerings/flex/ScrollBox.as b/src/as/com/threerings/flex/ScrollBox.as index 769db657..62dfc55c 100644 --- a/src/as/com/threerings/flex/ScrollBox.as +++ b/src/as/com/threerings/flex/ScrollBox.as @@ -47,6 +47,10 @@ public class ScrollBox extends Canvas opaqueBackground = 0xFFFFFF; + _mask = new Sprite(); + rawChildren.addChild(_mask); + this.mask = _mask; + _box = new Sprite(); rawChildren.addChild(_box); @@ -65,8 +69,14 @@ public class ScrollBox extends Canvas recheckBounds(); graphics.clear(); - graphics.lineStyle(1, 0); + graphics.lineStyle(1, 0x000000, 1.0); graphics.drawRect(0, 0, width, height); + + var g :Graphics = _mask.graphics; + g.clear(); + g.beginFill(0xffffff, 0.0); + g.drawRect(0, 0, width, height); + g.endFill(); } protected function enterFrame (vent :Event) :void @@ -106,8 +116,8 @@ public class ScrollBox extends Canvas _bounds = bounds.clone(); _scroller = scroller; - _scale = Math.min(1, - Math.min(_maxWidth / _bounds.width, _maxHeight / _bounds.height)); + _scale = Math.min(1, Math.min(_maxWidth / _bounds.width, _maxHeight / _bounds.height)); + width = _scale * _bounds.width; height = _scale * _bounds.height; @@ -121,7 +131,8 @@ public class ScrollBox extends Canvas { var g :Graphics = _box.graphics; g.clear(); - g.beginFill(0x0000FF); + g.beginFill(0xffffff, 0.3); + g.lineStyle(1, 0x000000, 0.3); g.drawRect(0, 0, ww, hh); g.endFill(); } @@ -159,6 +170,7 @@ public class ScrollBox extends Canvas protected var _maxHeight :int; protected var _box :Sprite; + protected var _mask :Sprite; protected var _scale :Number;