Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Seguinte, no palco eu vou ter um retangulo maior que vai ser o board;
E varios retangulos menores de tamanhos diferentes, preciso arrastar os menores pra dentro do maior(board) e que eles se acomodem dentro do mesmo
Sendo que tem que haver uma distancia padrão entre os menores, e que quando tirar um menor, os demais vão pra direita e ocupem o seu espaço...
Consegui isso em partes, o código não é de alto nivel, rs
Se alguém puder dar uma força, vejam se ficou claro o que eu quero
Segue o código
plat = 5; pedal01.onPress = function() { this.startDrag(); }; pedal02.onPress = function() { this.startDrag(); }; pedal03.onPress = function() { this.startDrag(); }; pedal04.onPress = function() { this.startDrag(); }; pedal05.onPress = function() { this.startDrag(); }; pedal01.onRelease = pedal01.onReleaseOutside=function () { this.stopDrag(); if (this.hitTest(_root.board)) { this._x = _root.board._x+plat; this._y = _root.board._y+5; plat = plat+this._width+5; p1b = true; } else { p1b = false; plat = plat-this._width; } }; pedal02.onRelease = pedal02.onReleaseOutside=function () { this.stopDrag(); if (this.hitTest(_root.board)) { this._x = _root.board._x+plat; this._y = _root.board._y+5; plat = plat+this._width+5; p1b = true; } else { p1b = false; plat = plat-this._width; } }; pedal03.onRelease = pedal03.onReleaseOutside=function () { this.stopDrag(); if (this.hitTest(_root.board)) { this._x = _root.board._x+plat; this._y = _root.board._y+5; plat = plat+this._width+5; p1b = true; } else { p1b = false; plat = plat-this._width; } }; pedal04.onRelease = pedal04.onReleaseOutside=function () { this.stopDrag(); if (this.hitTest(_root.board)) { this._x = _root.board._x+plat; this._y = _root.board._y+5; plat = plat+this._width+5; p1b = true; } else { p1b = false; plat = plat-this._width; } }; pedal05.onRelease = pedal05.onReleaseOutside=function () { this.stopDrag(); if (this.hitTest(_root.board)) { this._x = _root.board._x+plat; this._y = _root.board._y+5; plat = plat+this._width+5; p1b = true; } else { p1b = false; plat = plat-this._width; } };
Carregando comentários...