Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-02-2008, 06:04 PM   PM User | #1
luisdeita
New to the CF scene

 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
luisdeita is an unknown quantity at this point
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.
luisdeita is offline   Reply With Quote
Old 12-02-2008, 10:07 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
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.
gnomeontherun is offline   Reply With Quote
Old 12-02-2008, 10:43 PM   PM User | #3
luisdeita
New to the CF scene

 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
luisdeita is an unknown quantity at this point
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.
luisdeita is offline   Reply With Quote
Old 12-02-2008, 10:57 PM   PM User | #4
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
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.
gnomeontherun is offline   Reply With Quote
Old 12-02-2008, 11:01 PM   PM User | #5
luisdeita
New to the CF scene

 
Join Date: Dec 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
luisdeita is an unknown quantity at this point
Maybe my question should be how do I put all my code in a function?
thanks
luisdeita is offline   Reply With Quote
Old 12-02-2008, 11:08 PM   PM User | #6
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
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.
gnomeontherun is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:57 PM.


Advertisement
Log in to turn off these ads.