I'm trying to do a mask on a circle shape in ActionScript 3 (I'm using the Flex AIR framework). It has to do with the ecological footprint, each circle representing one earth. This ecological footprint picture is inside a container. The problem is that the mask seems to be fixed, though the picture floats. When I scroll the container down, the picture will scroll just fine, but the mask won't, clipping out the top of the picture. I've put this and other UIMovieClip in a VBox container. That VBox container is inside yet another VBox container. If I put the fomer VBox container on the bottom of the latter, the mask will not go with it, so the circle won't be masked.
mask = new UIMovieClip();
mask.graphics.beginFill(0xFFFFFF);
mask.graphics.drawRect(radius,radius+radius*2*(1-(ecoWeight-Math.floor(ecoWeight))),1000,1000);
mask.graphics.endFill();
earth = new UIMovieClip();
earth.graphics.beginFill(0xFFFFFF);
earth.graphics.drawCircle(radius,radius,radius);
earth.mask=mask;
earth.graphics.endFill();