Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Actionscript in Flash CS3

    Hello, I'm using a "class" to animate some text and need the animation to restart every 8 seconds. I'm learning Flash and I can't make the actionscript replay the animation.

    Here's the code that I have:
    //
    //stop();
    //
    import textTransition;
    import mx.transitions.easing.*;
    var t:textTransition = new textTransition(yourTextfield, {mode:"line", speed:2000, gap:700, ease:Elastic.easeOut, _yscale:0, _xscale:0, _alpha:100, _x:yourTextfield._width/2, _y:yourTextfield._height/2});
    //
    //
    var t:textTransition = new textTransition(text1);
    //At a later time use...
    t.restart();


    Any help is appreciated.

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    If you have made the animation all in Actionscript, then just put all of that code inside of a function, and then use setInterval to have it called every 8 seconds like this

    Code:
    interval = setInterval(animationFunction, 8000);
    The 8000 equals 8000 milliseconds, which is 8 seconds.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jeremywilken View Post
    If you have made the animation all in Actionscript, then just put all of that code inside of a function, and then use setInterval to have it called every 8 seconds like this

    Code:
    interval = setInterval(animationFunction, 8000);
    The 8000 equals 8000 milliseconds, which is 8 seconds.
    Hello, could you be so kind to post the entire code that I should use please.
    Thanks for your help.

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    That is the code. I don't know all of your code, but as I've said you need to put your custom code inside of a function and then call it in the setInterval function.

    See the documentation for more examples too.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #5
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe my question should be how do I put all my code in a function?
    thanks

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    You can declare custom functions like this, and then put your code in between the brackets.

    Code:
    function MyAnimation(){
    animation code here...
    }
    http://www.oman3d.com/tutorials/flash/intro_func_bc/ covers this information if you need more.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Posting Permissions

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