random order not executed
over1 = this.A1.on("mouseover", onMouseOver.bind(this));
over2 = this.A2.on("mouseover", onMouseOver.bind(this));
over3 = this.A3.on("mouseover", onMouseOver.bind(this));
over4 = this.A4.on("mouseover", onMouseOver.bind(this));
over5 = this.A5.on("mouseover", onMouseOver.bind(this));
over6 = this.A6.on("mouseover", onMouseOver.bind(this));
over7 = this.A7.on("mouseover", onMouseOver.bind(this));
over8 = this.A8.on("mouseover", onMouseOver.bind(this));
over9 = this.A9.on("mouseover", onMouseOver.bind(this));
over10 = this.A10.on("mouseover", onMouseOver.bind(this));
over11 = this.A11.on("mouseover", onMouseOver.bind(this));
over12 = this.A12.on("mouseover", onMouseOver.bind(this));
function onMouseOver(evt) {
item = evt.currentTarget;
item.cursor = "pointer";
}
down1 = this.A1.on("mousedown", onMouseDown.bind(this));
down2 = this.A2.on("mousedown", onMouseDown.bind(this));
down3 = this.A3.on("mousedown", onMouseDown.bind(this));
down4 = this.A4.on("mousedown", onMouseDown.bind(this));
down5 = this.A5.on("mousedown", onMouseDown.bind(this));
down6 = this.A6.on("mousedown", onMouseDown.bind(this));
down7 = this.A7.on("mousedown", onMouseDown.bind(this));
down8 = this.A8.on("mousedown", onMouseDown.bind(this));
down9 = this.A9.on("mousedown", onMouseDown.bind(this));
down10 = this.A10.on("mousedown", onMouseDown.bind(this));
down11 = this.A11.on("mousedown", onMouseDown.bind(this));
down12 = this.A12.on("mousedown", onMouseDown.bind(this));
function onMouseDown(evt) {
item = evt.currentTarget;
x = evt.currentTarget.x;
y = evt.currentTarget.y;
item.offset = {
x: 0,
y: 0
};
pt = item.parent.globalToLocal(evt.stageX, evt.stageY);
item.x = pt.x;
item.y = pt.y;
item.drag = true;
}
move1 = this.A1.on("pressmove", onMouseMove.bind(this));
move2 = this.A2.on("pressmove", onMouseMove.bind(this));
move3 = this.A3.on("pressmove", onMouseMove.bind(this));
move4 = this.A4.on("pressmove", onMouseMove.bind(this));
move5 = this.A5.on("pressmove", onMouseMove.bind(this));
move6 = this.A6.on("pressmove", onMouseMove.bind(this));
move7 = this.A7.on("pressmove", onMouseMove.bind(this));
move8 = this.A8.on("pressmove", onMouseMove.bind(this));
move9 = this.A9.on("pressmove", onMouseMove.bind(this));
move10 = this.A10.on("pressmove", onMouseMove.bind(this));
move11 = this.A11.on("pressmove", onMouseMove.bind(this));
move12 = this.A12.on("pressmove", onMouseMove.bind(this));
function onMouseMove(evt) {
item = evt.currentTarget;
this.setChildIndex(item, this.getNumChildren() - 1)
if (item.drag) {
pt = item.parent.globalToLocal(evt.stageX, evt.stageY);
item.x = pt.x;
item.y = pt.y;
}
}
/////////////////////////////////////////////////////////
this.A1.on("pressup", onMouseUp1.bind(this));
this.A1.place1 = this.place1;
function onMouseUp1(evt) {
item = evt.currentTarget;
pt1 = item.localToLocal(this.x, this.y, item.place1);
if (item.place1.hitTest(pt1.x, pt1.y) && p1 == 0) {
this.goood.play();
p1 = 1;
item.x = item.place1.x;
item.y = item.place1.y;
this.A1.off("mouseover", over1);
this.A1.off("mousedown", down1);
this.A1.off("pressmove", move1);
this.A1.mouseEnabled = false;
} else {
item.x = x;
item.y = y;
this.bad.play();
}
.
.
.
.
.
.
this.start = function () {
that.startButton.on("click", function (e) {
that.startTimer(that.updateCallBack, that.endCallback);
that.start_but_bg.visible = false;
that.startButton.visible = false;
root.shuffle();
}, this);
var restart = root.restart;
this.shuffle = function () {
setChildIndex.positions.sort(function (x, b) {
return 0.5 - Math.random();
item.originalX = positions[pt].x;
item.originalY = positions[pt].y;
item.mouseEnabled = true;
createjs.Tween.get(item).to({
x: item.originalX,
y: item.originalY
}, 350, createjs.Ease.backInOut);
});
puzzle
Why is random order not executed when I press start for 12 moviclip ??
root.shuffle();
??
var restart = root.restart;
this.shuffle = function () {
setChildIndex.positions.sort(function (x, b) {
return 0.5 - Math.random();
item.originalX = positions[pt].x;
item.originalY = positions[pt].y;
item.mouseEnabled = true;
createjs.Tween.get(item).to({
x: item.originalX,
y: item.originalY
}, 350, createjs.Ease.backInOut);
});
