# Layers and Actionscript problem

**URL:** <https://forum.kirupa.com/t/layers-and-actionscript-problem/115508>\
**Category:** Uncategorized\
**Created:** [July 9, 2004, 7:06am UTC](https://forum.kirupa.com/t/layers-and-actionscript-problem/115508 "2004-07-09T07:06:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frippdullah](https://avatars.discourse-cdn.com/v4/letter/f/94ad74/32.png) [@frippdullah](https://forum.kirupa.com/u/frippdullah)\
**Post date:** [July 9, 2004, 7:06am UTC](https://forum.kirupa.com/t/layers-and-actionscript-problem/115508/1 "2004-07-09T07:06:58Z")

</div>

i’m new to flash, so if you kindly respond, i wish to thank you ahead of time.

here’s what i have…  
layer 1: a rectangle which i have drawn with the rectangle option from ‘tools’  
layer 2: actionscript which draws a circle  
layer 3: actionscript which uses startdrag to attach the rectangle to my  
mouse cursor

when i test the movie, the rectangle appears to pass behind the actionscript generated circle…

i would like the reverse to happen, the rectangle seeming to pass infront of or above the actionscript generated circle.

can this be done?

here’s the code of my layers…

layer 1: (no code) drawn rectangle movieclip named ‘rect’

layer 2: actionscripted circle

MovieClip.prototype.drawCircle = function(r, x, y) {  
this.moveTo(x+r, y);  
a = Math.tan(22.5 \* Math.PI/180);  
for (var angle = 45; angle\<=360; angle += 45) {  
// endpoint:  
var endx = r_Math.cos(angle_Math.PI/180);  
var endy = r_Math.sin(angle_Math.PI/180);  
// control:  
// (angle-90 is used to give the correct sign)  
var cx =endx + r_a_Math.cos((angle-90)_Math.PI/180);  
var cy =endy + r_a\*Math.sin((angle-90)\*Math.PI/180);  
this.curveTo(cx+x, cy+y, endx+x, endy+y);  
}  
}  
xPos = 30;  
yPos = 28;

\_root.createEmptyMovieClip(“circle\_mc”, 1);  
circle\_mc.lineStyle(1, 0x000000, 100);  
circle\_mc.beginFill(0x0000ff, 100);  
circle\_mc.drawCircle(37, xPos, yPos);  
circle\_mc.endFill();  
circle\_mc.onPress = function() {  
trace(“pressed”);  
};

layer 3: startDrag(\_root.rect, true);

thanks in advance…  
j.
