-
1. Re: Disable click
Bharadwaj Sep 23, 2014 2:12 AM (in response to ianloh123)Instead of using
sym.play();
sym.stop("end");
for the click handler.
Check the position of the symbol and call play on it, if it is at the beginning.
-
2. Re: Disable click
ianloh123 Sep 23, 2014 2:36 AM (in response to Bharadwaj)Hi again Bharadwaj!
Sorry i'm not sure what you mean. But here's the sample if u'd like to take a closer look.
-
3. Re: Disable click
Bharadwaj Sep 23, 2014 3:06 AM (in response to ianloh123)In the attached file clicking on the rectangle plays the animation.
You can reset the animation by clicking "X" at the corner.
Is this the behaviour you want. Clicking on rectangle plays the animation only if the reset button is not visible?
-
4. Re: Disable click
joel_pau Sep 23, 2014 9:55 AM (in response to Bharadwaj)If you want one and only one click, you can add this line to Rectangle2.click: sym.$(e.target).off().css("cursor","default");
The Rectangle2.click after being modified:
sym.play("play");
sym.$("Text").show();
sym.$("mail_icon").show();
sym.$(e.target).off().css("cursor","default");
-
5. Re: prevent subsequent clicks of button in Edge Animate (was: Disable click)
ianloh123 Sep 23, 2014 7:31 PM (in response to Bharadwaj)Spot on Bharadwaj!
Perhaps a better explanation would be:
When "X" is hidden, "Rectangle2" can be clicked
When "X" is shown, "Rectangle2" cannot be clicked
-
6. Re: prevent subsequent clicks of button in Edge Animate (was: Disable click)
ianloh123 Sep 23, 2014 7:34 PM (in response to joel_pau)Thx Joel! The code works great.
But, as per my reply to Bharadwaj above, i now need another code to enable "Rectangle2" once more. This would probably go in X's click event, i think?
Sorry if my previous explanation was vague
-
7. Re: prevent subsequent clicks of button in Edge Animate (was: Disable click)
ianloh123 Sep 23, 2014 7:44 PM (in response to ianloh123)Just a bit more info, in case it comes in handy:
I'm intending to ultimately create a collage of tiled mugshots of people. So i may be gravely mistaken, but i'm hoping that once i get this one "Rectangle" sorted out, i can apply it in array, using the same rules, to many more tiles.
-
8. Re: prevent subsequent clicks of button in Edge Animate (was: Disable click)
Bharadwaj Sep 24, 2014 2:09 AM (in response to ianloh123)Hi Ian,
If you want to bring back the event handler when clicked on "X". Then this is not possible if you remove the event handler using off.
Instead of using off to remove event listener. Check whether "X" is visible and perform the operation
if(sym.$("Text").css("display") == "none")
{
sym.play("play");
sym.$("Text").show();
sym.$("mail_icon").show();
sym.$("Rectangle2").css("cursor","default");
}
Similarly click handler for "X" will be as follows
sym.playReverse("mailout");
sym.$("Text").hide();
sym.$("mail_icon").hide();
sym.$("Rectangle2").css("cursor","pointer");
-
9. Re: prevent subsequent clicks of button in Edge Animate (was: Disable click)
Bharadwaj Sep 24, 2014 2:17 AM (in response to ianloh123)If you do not want perform the operation based on visibility, add a class to the rectangle when clicked and remove it when clicked on "X"
This class can be used to perform the operation
Click handler for Rectangle2 will be
if(!sym.$( "Rectangle2" ).hasClass( "clicked" ))
{
sym.play("play");
sym.$("Text").show();
sym.$("mail_icon").show();
sym.$("Rectangle2").css("cursor","default");
sym.$( "Rectangle2" ).addClass( "clicked" )
}
Click handler for Text will be
sym.playReverse("mailout");
sym.$("Text").hide();
sym.$("mail_icon").hide();
sym.$("Rectangle2").css("cursor","pointer");
sym.$( "Rectangle2" ).removeClass( "clicked" );
Both the techniques work.
-
10. Re: prevent subsequent clicks of button in Edge Animate (was: Disable click)
ianloh123 Sep 24, 2014 2:32 AM (in response to Bharadwaj)Exactly wat i'm looking for, thx again Bharadwaj!
i will also give the class approach a try.
Now if only i could rename this thread to "How to toggle click event on/off"
Thx to all for the help!



