2 Replies - 2728 Views - Last Post: 05 June 2011 - 07:38 PM

#1 d.buckner  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 04-December 08

Animation not completed before next instruction.

Posted 05 June 2011 - 11:44 AM

Having a small problem with animation. I have a storyboard that is set to begin when the user clicks the button. The problem I am having is the next instruction is to collapse some of the items. The animation is not completing before the items are set to collapse. How can I make sure the animation is complete before the next instruction is executed? I have tried the storyboard.completed() event but I am afraid I do not understand how to implement it in this situation. Here is the code I have:

private void StartButton_Click(object sender, RoutedEventArgs e)
        {

            OpeningAnimation.Begin();
            
            PlayNewFile(("Sounds/shuffle.wav"));
                        
            StartUp.Visibility = System.Windows.Visibility.Collapsed;
            GamePlay.Visibility = System.Windows.Visibility.Visible;



Right now, when the button is clicked, all that appears to be happening is the sound is played. Then the visibility changes are made. If I disable the visibility changes, the animation plays as it should. I just need the animation to complete while the sound is being played and complete before the visibility changes are started.

This post has been edited by d.buckner: 05 June 2011 - 11:53 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Animation not completed before next instruction.

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Animation not completed before next instruction.

Posted 05 June 2011 - 01:31 PM

So what happens when you use the completed event? You should put the visibility code in the completed event.
Was This Post Helpful? 1
  • +
  • -

#3 d.buckner  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 73
  • Joined: 04-December 08

Re: Animation not completed before next instruction.

Posted 05 June 2011 - 07:38 PM

After playing around with the Completed event, I was able to get it to work. Thanks, I should have tried a little more before posting this question.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1