
Код AS3:
function backF (e:MouseEvent):void
{
switch (e.target) // можно так же сравнивать по инстанснеймам, как вам там удобнее
{
case lamp:
useLamp();
break;
case ampermetr:
useAmpermetr();
break;
case voltmetr:
useVoltmetr();
break;
}
}
private function useLamp():void
{
lamp.stopDrag();
// new Tween(lamp, "x", Strong.easeOut, lamp.x, point1.hitTestPoint(lamp.x, lamp.y) ? point1.x : place.x, 0.5, true);
// new Tween(lamp, "y", Strong.easeOut, lamp.y, point1.hitTestPoint(lamp.x, lamp.y) ? point1.y : place.y, 0.5, true);
// можно в одну строчку как выше, но пример ниже нагляднее, хотя смысл тот же
if (point1.hitTestPoint(lamp.x, lamp.y))
{
new Tween(lamp, "x", Strong.easeOut, lamp.x, point1.x, 0.5, true);
new Tween(lamp, "y", Strong.easeOut, lamp.y, point1.y, 0.5, true);
} else {
moveBackX = new Tween(lamp, "x", Strong.easeOut, lamp.x, place.x, 0.5, true)
moveBackY = new Tween(lamp, "y", Strong.easeOut, lamp.y, place.y, 0.5, true)
}
}
то есть для каждого обьекта пишете свою функцию и все.