![]() |
|
||||||||||
|
|||||
|
Регистрация: Nov 2008
Сообщений: 33
|
Двадцать клипов ["mc"+i] при хиттесте с любым из ["m"+i] = какоето действие.
Непонимаю в чём ошибка. Не хиттестится (. Help. //
import mx.utils.Delegate;
for (var i:Number = 1; i<=20;i++) {
this["mc"+i].onPress=function () {
this.startDrag();
this.swapDepths(getNextHighestDepth())
}
this["mc"+i].onRelease=function () {
this.stopDrag();
if (this.hitTest(["m"+i])) {
this._x=["m"+i]._x
this._y=["m"+i]._y
trace ("ок")
delete this.onPress;
delete this.onRelease;
}
}
}
|
|
|||||
|
Регистрация: Nov 2007
Сообщений: 1,724
|
for (var i:Number = 1; i <= 20; i++) { this["mc"+i].onPress=function () { this.startDrag(); this.swapDepths(getNextHighestDepth()); } this["mc"+i].onRelease=function () { this.stopDrag(); for (var n:Number = 1; n <= 20; n++) { if (this.hitTest(["m"+n])) { this._x = ["m" + n]._x; this._y = ["m" + n]._y; trace ("ок"); delete this.onPress; delete this.onRelease; } } } } |
|
|||||
|
Регистрация: Nov 2008
Сообщений: 33
|
и так не хиттестится.
|
|
|||||
|
Регистрация: Nov 2007
Сообщений: 1,724
|
for (var i:Number = 1; i <= 20; i++) { mc = attachMovie("m", "m"+i, i); mc.onPress = function():Void { trace(9) this.startDrag(); this.swapDepths(getNextHighestDepth()); } mc.onRelease = function():Void { this.stopDrag(); for (var n:Number = 1; n <= 20; n++) { if (this.hitTest(_root["m"+n])) { if (this != _root["m"+n]) { this._x = ["m" + n]._x; this._y = ["m" + n]._y; trace ("ок"); delete this.onPress; delete this.onRelease; } } } } } |
|
|||||
|
Регистрация: Nov 2008
Сообщений: 33
|
а так и на press не откликается.
|
|
|||||
|
Регистрация: Nov 2007
Сообщений: 1,724
|
как вы аттачите клипы?
|
|
|||||
|
Регистрация: Nov 2008
Сообщений: 33
|
там без аттачей. просто двадцать одних (mc1,mc2,mc3....) и двадцать других
|
|
|||||
|
Регистрация: Nov 2007
Сообщений: 1,724
|
тогда исходник
|
|
|||||
|
Регистрация: Nov 2008
Сообщений: 33
|
вот так вот заработало всё
for (var i:Number = 1; i <= 20; i++) { this["mc"+i].onPress = function():Void { this.startDrag(); this.swapDepths(getNextHighestDepth()); } this["mc"+i].onRelease = function():Void { this.stopDrag(); for (var n:Number = 1; n <= 20; n++) { if (this.hitTest(_root["m"+n])) { this._x = _root["m" + n]._x; this._y = _root["m" + n]._y; trace ("ок"); delete this.onPress; delete this.onRelease; } } } } Добавлено через 4 минуты спасибо за помошь. ) |
![]() |
![]() |
Часовой пояс GMT +4, время: 11:19. |
|
|
« Предыдущая тема | Следующая тема » |
|
|