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

I need help! This is for school, it's important!! The animation within my symbol doesn't finish before everything moves onto the next scene.

New Here ,
Mar 30, 2016 Mar 30, 2016

Heyy! I got a bit of a problem I got a deadline in 5 hours and I need to make a virtual reality Everything is going great except one thing, and it needs to be fixed. I have a counter in a scene, if it reaches three it goes on to the next scene. it counts every time it clicks on a mouse event. I added the mouse events to symbols and those symbols are animations, I putted the animation within, so when you click on one it does something. the problem I have is, when the counter reaches 3 it instantly moves on to the next scene instead of finishing the symbol animation first. so how do I let the movie clip finish before it moves on to the next frame? I've been searching google for hours and I know I'm a bit late. I really need the help and I appreciate it a lot!!
I'll leave my action script code down here if it helps any.

var Teller = 0;

{if (Teller == 3)

  MovieClip(root).gotoAndStop(3);}

import flash.events.MouseEvent;

spacemaan.buttonMode = true;

spacemaan.mouseChildren = false;

spacemaan.addEventListener(MouseEvent.CLICK, startspacemaanAnimatie)

function startspacemaanAnimatie(evt: MouseEvent) {

  spacemaan.removeEventListener(MouseEvent.CLICK, startspacemaanAnimatie)

  spacemaan.play();

  Teller++;

  if (Teller >= 3) {

  MovieClip(root).gotoAndStop(3);

}

}

Gebouw.buttonMode = true;

Gebouw.mouseChildren = false;

Gebouw.addEventListener(MouseEvent.CLICK, startGebouwAnimatie)

function startGebouwAnimatie(evt: MouseEvent) {

  Gebouw.removeEventListener(MouseEvent.CLICK, startGebouwAnimatie)

  Gebouw.play();

  Teller++;

  if (Teller >= 3) {

  MovieClip(root).gotoAndStop(3);

}

}

flower.buttonMode = true;

flower.mouseChildren = false;

flower.addEventListener(MouseEvent.CLICK, startflowerAnimatie)

function startflowerAnimatie(evt: MouseEvent) {

  flower.removeEventListener(MouseEvent.CLICK, startflowerAnimatie)

  flower.play();

  Teller++;

  var mySound:Sound = new PlantGrowing();

  mySound.play();

}

TOPICS
ActionScript
217
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
LEGEND ,
Mar 30, 2016 Mar 30, 2016

One way could be to have a status variable that gets checked before the scene change is made.  Have the functions start a checking function instead of a gotoAndStop(3) command and in that function be repeatedly checking that status variable.  Have the end of the animation change that status variable and the checking function can then use the gotoAndStop(3)

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
New Here ,
Mar 30, 2016 Mar 30, 2016

how do I do that, if I may ask?

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
LEGEND ,
Mar 30, 2016 Mar 30, 2016
LATEST

I do not do students' assignments for them so you will have to try to work thru the description I provide below... realizing that I use function/variable names and values that I made up to be descriptive... you can name them as you please.

Use: addEventListener(Event.ENTER_FRAME, checkVariable); instead of gotoAndStop(3);

The ENTER_FRAME will process the checkVariable function continuously

and in the checkVariable function you have it check to see if the value indicates the animation has ended.

function checkVariable(evt:Event) {

     if(theVariable = "animation done"){

          1) remove the event listener to stop the ENTER_FRAME processing

          2) use the gotoAndStop(3) command here

     }

}

In your animation, at the end of it, set theVariable to equal "animation done"

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