# Sending actionscript rectangle to back layer

**URL:** <https://forum.kirupa.com/t/sending-actionscript-rectangle-to-back-layer/255627>\
**Category:** flash\
**Created:** [March 25, 2008, 1:52pm UTC](https://forum.kirupa.com/t/sending-actionscript-rectangle-to-back-layer/255627 "2008-03-25T13:52:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdamon78](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jdamon78](https://forum.kirupa.com/u/jdamon78)\
**Post date:** [March 25, 2008, 1:52pm UTC](https://forum.kirupa.com/t/sending-actionscript-rectangle-to-back-layer/255627/1 "2008-03-25T13:52:37Z")

</div>

Hi - Would really appreciate some help!

I’ve created a rectangular box with actionscript (code follows) and I need to make sure this stays in the background - so all other movieclips and symbols are visible when they are positioned over the top of it… I guess it’s using the swapDepths function although not sure? Can anyone help? Thanks.

this.createEmptyMovieClip(“rectangle\_mc”, 10);  
rectangle\_mc.\_x = 15;  
rectangle\_mc.\_y = 285;  
drawRoundedRectangle(rectangle\_mc, 520, 100, 15, 0x2C79BE, 100);  
function drawRoundedRectangle(target\_mc:MovieClip, boxWidth:Number, boxHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number):Void {  
with (target\_mc) {  
beginFill(fillColor, fillAlpha);  
moveTo(cornerRadius, 0);  
lineTo(boxWidth - cornerRadius, 0);  
curveTo(boxWidth, 0, boxWidth, cornerRadius);  
lineTo(boxWidth, cornerRadius);  
lineTo(boxWidth, boxHeight - cornerRadius);  
curveTo(boxWidth, boxHeight, boxWidth - cornerRadius, boxHeight);  
lineTo(boxWidth - cornerRadius, boxHeight);  
lineTo(cornerRadius, boxHeight);  
curveTo(0, boxHeight, 0, boxHeight - cornerRadius);  
lineTo(0, boxHeight - cornerRadius);  
lineTo(0, cornerRadius);  
curveTo(0, 0, cornerRadius, 0);  
lineTo(cornerRadius, 0);  
endFill();  
}  
}
