simple problem here is my code first

Intro_btn.addEventListener(MouseEvent.CLICK, Click);


function Click( event:MouseEvent):void {
	gotoAndStop("what to put here?");
}

and was wondering what do i place in the 'what to put here section so it goes to the next frame instead of a specific frame?

Dani AI

Generated

Quick recap and safer options. asked how to move the playhead one frame forward when a button is clicked and pointed in the right direction. The simplest, most robust patterns avoid arithmetic on frame numbers and handle edge cases (last frame, scene jumps, scope). The examples below show alternatives you can drop into the timeline without repeating earlier code.

startBtn.addEventListener(MouseEvent.CLICK, onAdvance);

function onAdvance(e:MouseEvent):void {
    // advance one frame and stop there (safer than manually adding numbers)
    if (currentFrame < totalFrames) {
        nextFrame();
    } else {
        // reached end: optionally loop or disable the control
        startBtn.mouseEnabled = false;
    }
}

If you want the movie to continue playing from the next frame (not stop), use the play-style jump instead of advancing one frame and stopping:

navBtn.addEventListener(MouseEvent.CLICK, jumpToScene2);

function jumpToScene2(e:MouseEvent):void {
    // go to Scene 2 frame 1 and let it play automatically
    gotoAndPlay(1, "Scene 2");
}

Troubleshooting notes (addresses 's scene problem): make sure the target scene/frame does not itself contain a stop() action on its first frame; use frame labels instead of numeric frames for clarity; verify the button instance name exactly matches the code; watch scope (code on a nested clip needs correct target reference); and use trace(currentFrame) or the Output panel to confirm the playhead location when debugging. Using labels and gotoAndPlay("labelName") is generally more maintainable than raw numbers, especially when scenes change during editing.

Recommended Answers

All 4 Replies

Member Avatar for Member #334542
Intro_btn.addEventListener(MouseEvent.CLICK, Click);


function Click( event:MouseEvent):void {
		gotoAndStop(currentFrame+1);
}

Hope this helps!!!!

commented: nice +11

you should not be allowed on here cos you are too good!
thank you very much m8, i appreciate it.
p.s funny cos i searched the internet and came across thatbut must of been slightly different.

I make a falsh move.
i have a scene 1 stop and click start button than go to scene 2 than i want movie is auto paly but moive is not after first scene
=======================
<FAKE SIGNATURE>

ahh yes i see your cunning jiggery pokery. nice one m8

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.