Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

playing an animation and THEN moving to a scene.

New Here ,
Apr 06, 2014 Apr 06, 2014

Hello everyone, i'm new to flash and i've got quite a simple question:

I've created a game. Let's say I have an instructions screen, and a game intro screen. The instructions screen has a back button that has a mouse over/click/out animation. I can get the mouse out and over functionality working, but so far all I've been able to do when CLICKING the back button is to jump directly back to game intro, without playing the click animation first. How do I play the animation, and THEN go to a scene? Thanks. Here's my code within my back button symbol:

import flash.events.MouseEvent;

backButton.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver);

backButton.addEventListener(MouseEvent.CLICK, handleMouseClick);

backButton.addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut);

function handleMouseOver(e:MouseEvent){

gotoAndPlay("over")

}

function handleMouseClick(e:MouseEvent){

gotoAndPlay("click");

}

function handleMouseOut(e:MouseEvent){

gotoAndPlay("out")

}

Here's my code on the Instructions scene maintimeline:

stop();

import flash.events.MouseEvent;

backButton.addEventListener(MouseEvent.CLICK, handleBackClick)

playButton.addEventListener(MouseEvent.CLICK, handlePlayClick)

function handleBackClick(e:MouseEvent):void{

          gotoAndplay(1, "Gameintro");

}

function handlePlayClick(e:MouseEvent):void{

          gotoAndPlay(1, "Gameplay")

}

TOPICS
ActionScript
264
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 06, 2014 Apr 06, 2014

You need the call to the handleBackClick function to be triggered by the end of the gotoAndPlay("click") animation, not by clicking it.

Translate
LEGEND ,
Apr 06, 2014 Apr 06, 2014
LATEST

You need the call to the handleBackClick function to be triggered by the end of the gotoAndPlay("click") animation, not by clicking it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines