Actionscript mask, border, and background

Hello, I’m wondering if anyone could provide me with a tutorial or any useful code to creat a mask, border, and background to an image using actionscript. Here’s what the layers will look like.

Layer 4 (Border): 1px stroke of a rounded rectangle
Layer 3 (Mask): Rounded rectangle fill to mask image
Layer 2 (Image): The image
Layer 1 (Background): Rounded rectangle no stroke

I would like to get layers 1,3, and 4 to get the width, height, and x & y coordinates of layer 2 and size and place themselves accordingly. Layer 1 will be positioned 3 pixels to right and 3 pixels down.

Would each element (border, mask, image, background) need to be a graphic symbol or movie clip? Either way, let’s say the instance names are relavent.

This would be great to save some time. Instead of manually resizing the layers to fit the image, we can just have everything on the stage and let them resize themselves via actionscript according to the size and location of the image. (perhaps sort of along the lines of a flash version of a photoshop action or CSS class).

Any help would be greatly appreciated.