went
13.11.2006, 10:17
Люди, проблема в следующем: есть объект - при клике на котором создаётся копия которую надо переместить в некоторую область, областей этих 5, если он отпускается вне области - копия удаляется, если в - то в точку с координатами. Область - мувик. Для 1,2,3,5 работает нормально, для 4-го помещает в область ???ПЯТОГО???, если убрать координаты у пятого то в четвёртом ложиться нормально, но тогда в пятом ложиться не совсем как надо... Немного сбивчиво, но более понятно изложить не получается, надеюсь поймёте
_root.muhSamBel.onPress = function() {
attachMovie("muhSamBel", "muhSamBel"+i, i, {_x:0, _y:0});
_root.n1 = "i: "+i;
_root["muhSamBel"+i].startDrag(true);
};
_root.muhSamBel.onRelease = _root.muhSamBel.onReleaseOutside=function () {
// _root.n2 = "i: "+ i;
_root["muhSamBel"+i].stopDrag();
if ((_root["muhSamBel"+i]._x>XY_b._x) and (_root["muhSamBel"+i]._x<(XY_b._x+XY_b._width)) and (_root["muhSamBel"+i]._y>XY_b._y-20) and (_root["muhSamBel"+i]._y<(XY_b._y+XY_b._height)) or
(_root["muhSamBel"+i]._x>XY_b5._x) and (_root["muhSamBel"+i]._x<(XY_b5._x+XY_b5._width)) and (_root["muhSamBel"+i]._y>XY_b5._y-20) and (_root["muhSamBel"+i]._y<(XY_b5._y+XY_b5._height)) or (_root["muhSamBel"+i]._x>XY_b2._x) and (_root["muhSamBel"+i]._x<(XY_b2._x+XY_b2._width)) and (_root["muhSamBel"+i]._y>XY_b2._y-/*20*/5) and (_root["muhSamBel"+i]._y<(XY_b2._y+XY_b2._height)) or (_root["muhSamBel"+i]._x>XY_b3._x) and (_root["muhSamBel"+i]._x<(XY_b3._x+XY_b3._width)) and (_root["muhSamBel"+i]._y>XY_b3._y-5) and (_root["muhSamBel"+i]._y<(XY_b3._y+XY_b3._height)) or (_root["muhSamBel"+i]._x>XY_b4._x) and (_root["muhSamBel"+i]._x<(XY_b4._x+XY_b4._width)) and (_root["muhSamBel"+i]._y>XY_b4._y-5) and (_root["muhSamBel"+i]._y<(XY_b4._y+XY_b4._height))) {
if ((_root["muhSamBel"+i]._y>XY_b._y-20) and (_root["muhSamBel"+i]._y<(XY_b._y+XY_b._height))) {
_root["muhSamBel"+i]._x = XY_b._x+XY_b._width/2+15;
_root["muhSamBel"+i]._y = XY_b._y+12;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b2._y-5) and (_root["muhSamBel"+i]._y<(XY_b2._y+XY_b2._height))) {
_root["muhSamBel"+i]._x = XY_b2._x+XY_b2._width/2+5;
_root["muhSamBel"+i]._y = XY_b2._y;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b3._y-5) and (_root["muhSamBel"+i]._y<(XY_b3._y+XY_b3._height))) {
_root["muhSamBel"+i]._x = XY_b3._x+XY_b3._width/2+5;
_root["muhSamBel"+i]._y = XY_b3._y;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b4._y-5) and (_root["muhSamBel"+i]._y<(XY_b4._y+XY_b4._height))) {
_root["muhSamBel"+i]._x = XY_b4._x+XY_b4._width/2+5;
_root["muhSamBel"+i]._y = XY_b4._y;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b5._y-20) and (_root["muhSamBel"+i]._y<(XY_b5._y+XY_b5._height))) {
_root["muhSamBel"+i]._x = XY_b5._x+XY_b5._width/2+15;
_root["muhSamBel"+i]._y = XY_b5._y+12;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
Ещё... если 5-й мувик ператащить в другое место - всё работает как надо
_root.muhSamBel.onPress = function() {
attachMovie("muhSamBel", "muhSamBel"+i, i, {_x:0, _y:0});
_root.n1 = "i: "+i;
_root["muhSamBel"+i].startDrag(true);
};
_root.muhSamBel.onRelease = _root.muhSamBel.onReleaseOutside=function () {
// _root.n2 = "i: "+ i;
_root["muhSamBel"+i].stopDrag();
if ((_root["muhSamBel"+i]._x>XY_b._x) and (_root["muhSamBel"+i]._x<(XY_b._x+XY_b._width)) and (_root["muhSamBel"+i]._y>XY_b._y-20) and (_root["muhSamBel"+i]._y<(XY_b._y+XY_b._height)) or
(_root["muhSamBel"+i]._x>XY_b5._x) and (_root["muhSamBel"+i]._x<(XY_b5._x+XY_b5._width)) and (_root["muhSamBel"+i]._y>XY_b5._y-20) and (_root["muhSamBel"+i]._y<(XY_b5._y+XY_b5._height)) or (_root["muhSamBel"+i]._x>XY_b2._x) and (_root["muhSamBel"+i]._x<(XY_b2._x+XY_b2._width)) and (_root["muhSamBel"+i]._y>XY_b2._y-/*20*/5) and (_root["muhSamBel"+i]._y<(XY_b2._y+XY_b2._height)) or (_root["muhSamBel"+i]._x>XY_b3._x) and (_root["muhSamBel"+i]._x<(XY_b3._x+XY_b3._width)) and (_root["muhSamBel"+i]._y>XY_b3._y-5) and (_root["muhSamBel"+i]._y<(XY_b3._y+XY_b3._height)) or (_root["muhSamBel"+i]._x>XY_b4._x) and (_root["muhSamBel"+i]._x<(XY_b4._x+XY_b4._width)) and (_root["muhSamBel"+i]._y>XY_b4._y-5) and (_root["muhSamBel"+i]._y<(XY_b4._y+XY_b4._height))) {
if ((_root["muhSamBel"+i]._y>XY_b._y-20) and (_root["muhSamBel"+i]._y<(XY_b._y+XY_b._height))) {
_root["muhSamBel"+i]._x = XY_b._x+XY_b._width/2+15;
_root["muhSamBel"+i]._y = XY_b._y+12;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b2._y-5) and (_root["muhSamBel"+i]._y<(XY_b2._y+XY_b2._height))) {
_root["muhSamBel"+i]._x = XY_b2._x+XY_b2._width/2+5;
_root["muhSamBel"+i]._y = XY_b2._y;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b3._y-5) and (_root["muhSamBel"+i]._y<(XY_b3._y+XY_b3._height))) {
_root["muhSamBel"+i]._x = XY_b3._x+XY_b3._width/2+5;
_root["muhSamBel"+i]._y = XY_b3._y;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b4._y-5) and (_root["muhSamBel"+i]._y<(XY_b4._y+XY_b4._height))) {
_root["muhSamBel"+i]._x = XY_b4._x+XY_b4._width/2+5;
_root["muhSamBel"+i]._y = XY_b4._y;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
if ((_root["muhSamBel"+i]._y>XY_b5._y-20) and (_root["muhSamBel"+i]._y<(XY_b5._y+XY_b5._height))) {
_root["muhSamBel"+i]._x = XY_b5._x+XY_b5._width/2+15;
_root["muhSamBel"+i]._y = XY_b5._y+12;
_root["muhSamBel"+i]._height = _root["muhSamBel"]._height*0.5;
_root["muhSamBel"+i]._width = _root["muhSamBel"]._width*0.5;
}
Ещё... если 5-й мувик ператащить в другое место - всё работает как надо