if statement ignored with onPressUp function
I don't get it. At the 'onPressUp' function I want the 'button2' movieclip to disappear and 'buttonAn' movieclip to play. But only if it is over the 650 y coordinate. I added the if statement but it is ignored.
Project file:
https://www.dropbox.com/s/mvpa1r73urwsvie/hide%20ball%20on%20drag%2008.fla?dl=0
var root = this;
this.button2.visible = false
this.buttonAn.visible = false
function main()
{
createjs.Touch.enable(stage);
root.mouseDownListener = root.button.on("mousedown", onMouseDown);
root.pressMoveListener = root.button.on("pressmove", onPressMove);
root.pressUpListener = root.button.on("pressup", onPressUp);
}
function onMouseDown(e)
{
e.currentTarget.offset = { y: (e.stageY / stage.scaleY) - e.currentTarget.y };
}
function onPressMove(e)
{
e.currentTarget.y = (e.stageY / stage.scaleY) - e.currentTarget.offset.y;
{
if (e.currentTarget.y > 650)
root.button.visible = false
root.buttonAn.visible = true
}
}
function onPressUp(e)
{
if (e.currentTarget.y > 650)
root.button.y = 275
root.fallingShape.play();
root.button2.visible = true
root.buttonAn.play();
}
main();
