locked
Stop and start animation RRS feed

  • Question

  • User-88471105 posted

    I must just be missing something really basic.  I've got a beautiful animation running, and I can't figure out how to stop it on a button click or mouse over!  I've searched for hours and haven't found a clue.

    <asp:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="imgFeatured0">
            <Animations>
                <OnMouseOver>
                    (what in the world goes here???)
                </OnMouseOver>
                <OnLoad>
                    <Sequence Iterations="0">

                    rest of animation...

    The only thing I've seen to go in the <OnMouseOver> tag is <Color>.  Is there a way to put a Stop method in there?

    As to a button click, I tried stopping it with this function:

    function StopAnimation()
        {
            document.getElementById("<%= AnimationExtender1.ClientID %>").stop();
        }

    However, I get a null reference trying to get the extender.

    HELP!


    Saturday, May 29, 2010 5:02 PM

Answers

  • User-88471105 posted

    PROBLEM SOLVED!

    I knew it had to be something simple and basic, but who really knows all this animation and syntax?  Not many, apparently.

    The solution was to NOT use the get_OnClickBehavior() after my $find, because I defined my animation in the <OnLoad> tag, not in the <OnClick> tag like everyone apparently assumes.

    Therefore, I simply had to change my function to:

        $find("FeaturedBehavior").get_OnLoadBehavior().get_animation().stop();

    Voila, it works!

    But, like I said, who really understands all this syntax?  Is there a definitive library out there somewhere that gives ALL the syntax, how/when to use it, including declarative and non-declarative syntax, etc.?  I still don't know how to call the Stop method from the declarative syntax.

    By the way, I HAVE to give credit to

    who pointed me in the right direction in his article:

         http://blogs.msdn.com/b/phaniraj/archive/2007/04/13/animations-how-many-ways-do-i-call-thee.aspx

    THANKS EVERYONE!




    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 30, 2010 10:38 AM

All replies

  • User-1360095595 posted

    Try giving you extender a BehaviorID value.  Now try using: $find('YourBehaviourID').stop();

    Saturday, May 29, 2010 9:23 PM
  • User-88471105 posted

    Yes, I was just in the midst of trying with the BehaviorId, but still no go.  I must be missing something really obvious - it can't be this hard!  5 hours hard so far...

    I added the BehaviorId here:

    <asp:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="imgFeatured0" BehaviorID="FeaturedBehavior">

    and changed my function to:

    function stopAnimation()
        {
            $find('FeaturedBehavior').stop();
        }

    and now I get:

    Object doesn't support this property or method

    I guess I consider that an improvement!

    Saturday, May 29, 2010 9:33 PM
  • User-88471105 posted

    Thanks, much appreciated, but still no luck.

    What he suggests is:

                var onclkBehavior = $find("FeaturedBehavior").get_OnClickBehavior().get_animation();
                onclkBehavior.stop();

    But get_OnClickBehavior is simply not defined, so I can't get beyond that.  I wonder if something has changed in AJAX since then.  I'm using the 30xxx version, not the 35xxx or 40212 because they don't work.


    Saturday, May 29, 2010 10:07 PM
  • User-88471105 posted

    I wonder if $find is no longer supported.  I've noticed that since installing VS2008 and .Net 3.5, $get no longer is supported.

    Here's the full error with above code:

    Microsoft JScript runtime error: 'get_OnClickBehavior()' is null or not an object


    Saturday, May 29, 2010 10:35 PM
  • User-88471105 posted

    Since someone obviously changed the water so $find no longer works, let me try the alternate approach.

    Does anyone know what goes between the <Action> and </Action> tags in an animation?  I know I can put things like Duration in there, but how would I put a method like Stop in there?

    I'm still searching and still haven't found a single example of what can go in the action tags.

    Thanks!


    By the way, when I look at $find in the Immediate Window, I see:

    ?$find("FeaturedBehavior")
    {...}
        _animations: {...}
        _duration: 1
        _events: {...}
        _fps: 25
        _id: null

    etc. whatever that means!


    Sunday, May 30, 2010 12:11 AM
  • User-88471105 posted

    PROBLEM SOLVED!

    I knew it had to be something simple and basic, but who really knows all this animation and syntax?  Not many, apparently.

    The solution was to NOT use the get_OnClickBehavior() after my $find, because I defined my animation in the <OnLoad> tag, not in the <OnClick> tag like everyone apparently assumes.

    Therefore, I simply had to change my function to:

        $find("FeaturedBehavior").get_OnLoadBehavior().get_animation().stop();

    Voila, it works!

    But, like I said, who really understands all this syntax?  Is there a definitive library out there somewhere that gives ALL the syntax, how/when to use it, including declarative and non-declarative syntax, etc.?  I still don't know how to call the Stop method from the declarative syntax.

    By the way, I HAVE to give credit to

    who pointed me in the right direction in his article:

         http://blogs.msdn.com/b/phaniraj/archive/2007/04/13/animations-how-many-ways-do-i-call-thee.aspx

    THANKS EVERYONE!




    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 30, 2010 10:38 AM