Hello! I'm just beginning to use Adobe Flash - in fact, I only started a few hours ago - so, I'm still learning the basics and am still tripping my own feet trying to understand how to script when all I want to do is make a flash comic. I'm trying to loop a few frames over and over again, until either a button that takes the reader to the next frame or another button that takes the reader to the previous frame is pressed. I want the looped frames (frames 2-21, to be specific) to loop for an infinite number of times, but I'm not sure if that's even possible with cs5. Haha.

I'm using the following code:

while (x<100) {
 2;

movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame);

function fl_ClickToGoToNextFrame(event:MouseEvent):void
{
    nextFrame();


movieClip_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousFrame);

function fl_ClickToGoToPreviousFrame(event:MouseEvent):void
{
    prevFrame();


}
}


stop();

}

And I'm getting the following error:

Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
    at Part1_fla::MainTimeline/frame21()

Thank you for taking the time to read this! My scripting is probably horrible, but please have mercy on me. XD

Member Avatar for rajarajan2017

No need of any code to utilize the frame from 2 to 21 for an continuous loop.

Create a new layer. Name it actions.

on 21st frame add a keyframe at the layer of actions and add gotoAndPlay(2);

Hence, when the frame reachest 21 the actions again repeat the frame from 2. Thats it!

No need of any code to utilize the frame from 2 to 21 for an continuous loop.

Create a new layer. Name it actions.

on 21st frame add a keyframe at the layer of actions and add gotoAndPlay(2);

Hence, when the frame reachest 21 the actions again repeat the frame from 2. Thats it!

Thank you so much! That fixed it perfectly!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.