locked
Event handlers RRS feed

  • Question

  • If you are adding event handlers in code. IfI want to change what that event does later on is there somethign special I need to do?

    I noticed I just keep adding an event handler   to the same object multiple times just with a slightly different action name.  I am having strange animation issues where the animation either flipflop from what they should do or just disappread as if you did a .stop()

    Can this assigning of add event handler over and over cause this? I can't seem to figure out where the issue is.  

     

     

    Tuesday, January 22, 2008 3:28 PM

Answers

  • those event handlers seem to be the issue. I removed any instance where I was doing a .stop() on the animation used except where I need to (other wise an error is caused)

    the animation used I dynamically set the Storyboard.Targetname and If I dont put a stop before doing that I get an error.

     

     

    UPDATE:

    I got it! that was hte issue. I removed the event listeners before recreating them and it seem to have fixed the issue.

    Tuesday, January 22, 2008 5:26 PM

All replies

  • At the risk of asking a dumb question, are you removing the previous handler when you 'keep adding an event handler' ?

    Are you getting interactions?

    -Dave

    Tuesday, January 22, 2008 3:53 PM
  • Hi,

    yes, it can, could you tell us what your two or more different actions does in the same event on one object?

    suppose that first action is setting an object's property and the second action changes it again....

    if this can be occur, remove last action and add the new action for that event.

    Tuesday, January 22, 2008 3:57 PM
  • I have one box that show up on screen and there is a button to push on it.

    That button will do an action to one of many other boxes. (it does a scale) OR that button may not do that scale storyboard, it may end up just making the box it;s in collapse.

     

    What is looks like is happening is after some combination of actions (I havnt been able to narrow it down yet) the actions just start going crazy. The action that should have the collapsing box now just disappears as if the storyboard was just stopped and the box ends up at its original state (which is scaled at 0 on both axis)

    It's hard to explain and my code is extensive so I don't I want to post eveything here.

     

    How do you clear out the event handler so that I can recreate it later on? 

     

    Tuesday, January 22, 2008 4:58 PM
  • those event handlers seem to be the issue. I removed any instance where I was doing a .stop() on the animation used except where I need to (other wise an error is caused)

    the animation used I dynamically set the Storyboard.Targetname and If I dont put a stop before doing that I get an error.

     

     

    UPDATE:

    I got it! that was hte issue. I removed the event listeners before recreating them and it seem to have fixed the issue.

    Tuesday, January 22, 2008 5:26 PM
  • cool!

    I thought that was it, and is why I asked the question I did :)

    -Dave

    Tuesday, January 22, 2008 6:12 PM