A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Global dec of Tween?

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    567

    Global dec of Tween?

    Code:
    var movingTween:Tween = new Tween(
    objectThatMoves, "x", Strong.easeInOut, objectThatMoves.x, 100, 3, true);
    
    objectThatMoves.addEventListener(MouseEvent.MOUSE_OUT, stopTween);
    And I want my stopTween function to stop the movingTween dead in it's tracks. I assumed it'd be something like movingTween.stop(); but my tween's not variable, and I can't apply stop() to the object, can I?

    So... is there a way to make the tween global? I thought I'd tried all the obvious ways, but I can't seem to get it. Or should I be doing something completely different?

    Thank you!

    (movingTween is added on a MOSE_OVER event)

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    I don't know it will work but you can try to put this inside the listener function:
    movingTween=null;
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    567
    I'm interested in what you thought that would do? Doesn't it just clear the variable... if it worked?

    I should clarify movingTween is declared within a function.

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    567
    Oh, I am the stupid.

    Declare this outside the function:
    Code:
    var movingTween:Tween;
    And inside the function
    Code:
    movingTween= new Tween(
    objectThatMoves, "x", Strong.easeInOut, objectThatMoves.x, 100, 3, true);
    
    objectThatMoves.addEventListener(MouseEvent.MOUSE_OUT, stopTween);
    Why I didn't see this a couple of days I go, I don't know. Actually, I do know, it was the keeping of "new tween" inside the function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center