Repeat an action every frame

I’m running Flash 8 and have a question about how to repeat an action on every frame.

I have a movie that has about 600 frames and I need an actionscript to run on every frame.  Initially I thought I could just create a layer with a keyframe at the first frame and another at the last one.  Then include an action in the initial keyframe and hope that the action is executed every frame…that didn’t work.

So now I’m in need of help.

To be more specific, I have a slider and need to record the value of the slider (user moves it throughout the movie to indicate enjoyment) every second (or every frame…either works).  So the code should look something like this:

On enter frame -> get value from slider -> store value from slider in array -> increment counter -> goto next slide

I could put the equivalent of that in every single frame (keyframe each), but as you can imagine this is not a very elegant or practical solution.

Any help is appreciated.

Thanks in advance!
Jeff
buktotruthAsked:
Who is Participating?
 
FLAASHERConnect With a Mentor Commented:
put ur code in this function :

function flaasher(){
//ur action code
//put it here
}


you need to put this funtion in the frist frame in ur time line


also in the frist frame call the function by this code :

_root.onEnterFrame = function(){
flaasher();
}



thats all


FLAASHER
0
 
FLAASHERCommented:
Your qestion is "Repeat an action every frame" ?

simply make the action u want to repeat as function :

function flaasher(){
//ur action code
//put it here
}


then call this function on enter each frame of ur time line like this :

_root.onEnterFrame = function(){
flaasher();
}


thats all :)

FLAASHER
0
 
buktotruthAuthor Commented:
what i'm trying to do is avoiding entering the code 600 times (once per frame)...so where would i put that code to make it replicate for each frame?  And how would i set up the timeline?

Thanks!
0
 
buktotruthAuthor Commented:
Awesome...worked like a charm.

Thanks for the Help!!
0
 
FLAASHERCommented:
U welcome :)

FLAASHER
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.