Hi,
I’ve got a movie clip that the user can pick up and move around the screen using drag and drop via actionscript. I’m trying to constrain the movie clip though - I want to limit where the movie clip can move to.
No problem, I thought - yet I’m now stuck. I want to contrain the movieClip around the top of a circle - i.e. not in a normal rectangle, but rather an oval.
I’m currently using a function to check where the mouse is, and if in a certain location, it changes the top boundary. However, there surely has to be an easier way? Any ideas?
function testarea() {
if (_root._xmouse>=224 && _root._xmouse<230) {
topBoundary = 275;
}
if (_root._xmouse>=169 && _root._xmouse<224) {
topBoundary = 273;
}
if (_root._xmouse>=135 && _root._xmouse<169) {
topBoundary = 270;
}
if (_root._xmouse>=100 && _root._xmouse<135) {
topBoundary = 266;
}
if (_root._xmouse>=80 && _root._xmouse<100) {
topBoundary = 262;
}
if (_root._xmouse>=70 && _root._xmouse<80) {
topBoundary = 258;
}
if (_root._xmouse>=60 && _root._xmouse<70) {
topBoundary = 256;
}
if (_root._xmouse>=50 && _root._xmouse<60) {
topBoundary = 252;
}
if (_root._xmouse>=40 && _root._xmouse<50) {
topBoundary = 250;
}
if (_root._xmouse>=30 && _root._xmouse<40) {
topBoundary = 248;
}
if (_root._xmouse>=20 && _root._xmouse<30) {
topBoundary = 244;
}
if (_root._xmouse>=230 && _root._xmouse<326) {
topBoundary = 275;
}
if (_root._xmouse>=326 && _root._xmouse<381) {
topBoundary = 273;
}
if (_root._xmouse>=381 && _root._xmouse<415) {
topBoundary = 270;
}
if (_root._xmouse>=415 && _root._xmouse<450) {
topBoundary = 266;
}
if (_root._xmouse>=450 && _root._xmouse<470) {
topBoundary = 262;
}
if (_root._xmouse>=470 && _root._xmouse<480) {
topBoundary = 258;
}
if (_root._xmouse>=480 && _root._xmouse<490) {
topBoundary = 256;
}
if (_root._xmouse>=490 && _root._xmouse<500) {
topBoundary = 252;
}
if (_root._xmouse>=500 && _root._xmouse<510) {
topBoundary = 250;
}
if (_root._xmouse>=510 && _root._xmouse<520) {
topBoundary = 248;
}
if (_root._xmouse>=520 && _root._xmouse<530) {
topBoundary = 244;
}
}
}
Any help most welcome :thumb2: