Statement if... else does not not for incrementing global vars and jump to the image labels

The problem I have is when I change my simple if statements 'else if' and increment a global variable, it really breaks the original "if". If you drag to the left, right, or bottom, it increments the overall "animCount" var and jumps to the label for specific image and play this animation. Then I would check if the val of animCount has been changed and if calls the user again left, right or down, it takes take-out of the Valley of "animCount" and I then I have another statement that checks for that and jumps to the new label for specific image and play this animation. The problem is that I can't have just a linear version of it down the main scenario for the scene to actually jump around at very specific points.

Here is the code that I have on document.compositionReady that works, but when you add the ElseIf breaks... What the devil I'm hurt!

Hope someone can help please

// Working Code ///////////////////////////////////////////////////////////

// GLOBAL VARS --------------------------------------------

this.animCount = 0;

by scanning

this.swipeStartX;

this.swipeEndX;

this.swipeStartY;

this.swipeEndY;

this.swipePadding = 60; / / avoid slipping when clicked

// ARROW BTNS --------------------------------------------

this.onSwipeLeft = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("anim_4");

}

}

this.onSwipeRight = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("anim_1");

}

}

this.onSwipeDown = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("ice_dunk_1");

}

}

// SWIPE --------------------------------------------

this.onSwipe = function()

{

forehand (scrub left)

If (this.swipeStartX < this.swipeEndX - this.swipePadding)

{

this.onSwipeRight ();

left by scanning (scrub on the right)

} ElseIf (this.swipeEndX < this.swipeStartX - this.swipePadding)

{

this.onSwipeLeft ();

slide downwards (scrub down)

} ElseIf (this.swipeStartY < this.swipeEndY - this.swipePadding)

{

this.onSwipeDown ();

}

}

// End Working Code ///////////////////////////////////////////////////////////

// Bad Code ///////////////////////////////////////////////////////////

// GLOBAL VARS --------------------------------------------

this.animCount = 0;

by scanning

this.swipeStartX;

this.swipeEndX;

this.swipeStartY;

this.swipeEndY;

this.swipePadding = 60; / / avoid slipping when clicked

// ARROW BTNS --------------------------------------------

this.onSwipeLeft = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("anim_4");

}

of other if(this.animCount == 1) {}

-this.animCount;

SYM. Play ("anim_2");

}

}

this.onSwipeRight = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("anim_1");

}

of other if(this.animCount == 1) {}

-this.animCount;

SYM. Play ("anim_5");

}

}

this.onSwipeDown = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("ice_dunk_1");

}

of other if(this.animCount == 1) {}

-this.animCount;

SYM. Play ("anim_3");

}

}

// SWIPE --------------------------------------------

this.onSwipe = function()

{

forehand (scrub left)

If (this.swipeStartX < this.swipeEndX - this.swipePadding)

{

this.onSwipeRight ();

left by scanning (scrub on the right)

} ElseIf (this.swipeEndX < this.swipeStartX - this.swipePadding)

{

this.onSwipeLeft ();

slide downwards (scrub down)

} ElseIf (this.swipeStartY < this.swipeEndY - this.swipePadding)

{

this.onSwipeDown ();

}

}

// End Bad Code ///////////////////////////////////////////////////////////

OK, that should be enough to help you ride--I put in place a machine States, with housing of switch for "onSwipeLeft" only. You can apply cela other shots. Here is a link to the code as well, as the forum sometimes mess up tab, making it really hard to read code. Let me know if you have any questions.

link to the code:

http://www.timjaramillo.com/code/edge/_source/_temp/test.js

// GLOBAL VARS --------------------------------------------

this.currentState is this. STATE_ICEBERG_UP; / / beginning of State

This. STATE_ICEBERG_UP = "iceberg_up";

This. STATE_ICEBERG_FLIPPED = "iceberg_flipped";

This. STATE_CREATURE_UP = "creature_up";

by scanning

this.swipeStartX;

this.swipeEndX;

this.swipeStartY;

this.swipeEndY;

this.swipePadding = 60; / / avoid slipping when clicked

// ARROW BTNS --------------------------------------------

this.onSwipeLeft = function()

{

Switch (this.currentState)

{

this case. STATE_ICEBERG_UP:

SYM. Play ("anim_4");

this.currentState is this. STATE_ICEBERG_FLIPPED;

break;

this case. STATE_ICEBERG_FLIPPED:

SYM. Play ("anim_2");

this.currentState is this. STATE_ICEBERG_UP;

break;

this case. STATE_CREATURE_UP:

SYM. Play ("anim_1");

this.currentState is this. STATE_ICEBERG_UP;

break;

by default:

Console.log ("onSwipeLeft, no break corresponding '");

break;

}

}

this.onSwipeRight = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("anim_1");

}

of other if(this.animCount == 1) {}

-this.animCount;

SYM. Play ("anim_5");

}

}

this.onSwipeDown = function()

{

if(this.animCount == 0) {}

this.animCount ++;

SYM. Play ("ice_dunk_1");

}

of other if(this.animCount == 1) {}

-this.animCount;

SYM. Play ("anim_3");

}

}

// SWIPE --------------------------------------------

this.onSwipe = function()

{

forehand (scrub left)

If (this.swipeStartX< this.swipeendx="" -="" this.swipepadding="">

{

this.onSwipeRight ();

left by scanning (scrub on the right)

} ElseIf (this.swipeEndX< this.swipestartx="" -="" this.swipepadding="">

{

this.onSwipeLeft ();

slide downwards (scrub down)

} ElseIf (this.swipeStartY< this.swipeendy="" -="" this.swipepadding="">

{

this.onSwipeDown ();

}

}

Tags: Edge Animate

Similar Questions

Maybe you are looking for

  • Tecra A8 PTA83E fan problem: SOLVED!

    As I say in this post: http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=21776, my tecra A8 fan still works at high rpm, and the service is unable to solve my problem.Now, the problem seems to be FIXED!I downloaded this update to

  • UPDATING the CHIPSET DRIVER for Z500

    Hello! I downloaded, the form of the lenovo, the latest drivers chipset, but after the download site, there is only a single setup file and that's it! I was wondering how do I uninstall the previous version and if there is anything 'special' or 'tric

  • Could not update "WindowsUpdate_80070663" "WindowsUpdate_dt000"

    "WindowsUpdate_80070663" "WindowsUpdate_dt000" Why can't so far?

  • Two devices in the file Explorer

    Hello! Today, I recognized that my Fuze is represented by two devices (with two different drive letters) in the file Explorer. The first device is named "SANSA FUZE" and can be opened, the other has no name and only an error message appears when I tr

  • Computer doesn't recognize me as an administrator, I am the only one!

    I just tried to download an update for a codec RAW to Win Live Photo Gallery.  Download would not end because he said I would need administrative access.  This often happens during the execution of other functions as well.  Quite often, I want to del