I am not able to understand framelevel code and onenterframe code. I have two frame that has action script code. I have the below code at keyframes frame1 and frame2. when it loops the frame trace message at frame level and onenterframe gets printed. What is the use of onenterframe code. code can be inserted at frame level. I thought that code at framelevel called once at the first time when the playhead enters the frame. When i delete the frame2 and only have frame1 only frame level trace code executed once. Not sure how frame level code executed once with one frame and if i have two frame frame level code executed multiple times.
**FRAME1**
trace("frame level");
this.onEnterFrame =function()
{
trace("calling onenterframe");
}
**FRAME2**
trace(" second frame level");
this.onEnterFrame =function()
{
trace("calling second onenterframe");
}
FRAME CODE
Running the above code will display what you expect i.e output
calling onenterframemultiple times.Basically, since you do not use stop flash keeps looping over the frames and running the frame script.
Using stop() ensures that flash runs the frame script once & stops.
If you add an enter frame event, then that function will be called again and again.