Skip to main content
Participant
September 17, 2012
Question

Skip intro button needs to disappear when next layer is shown

  • September 17, 2012
  • 1 reply
  • 820 views

I have a little card game that plays an animation at the beginning and has a "skip Intro" button. When a player clicks button it moves him to the main page to start the game. That works fine unless the player does not push the button. The animation finishes and it goes to main page but the "skip intro" button is still visible on the main page and wont disappear until it is clicked. I was wondering if there was a way to put this button on a timer so that visible status changes to false after set amount of time. Below is the code

public function document() {

   super();

   trace(" constructor code");

   targetMC = this;

   targetMC.mainscreen.visible = true;

   targetMC.mainscreen.playMC.addEventListener(MouseEvent.CLICK , mainscreenButtonHandler);

   targetMC.mainscreen.rulesMC.addEventListener(MouseEvent.CLICK , mainscreenButtonHandler);

   targetMC.helpscreen.returntogame.addEventListener(MouseEvent.CLICK , mainscreenButtonHandler);

   targetMC.help_btn.addEventListener(MouseEvent.CLICK , mainscreenButtonHandler);

   targetMC.helpscreen.visible = false;

   targetMC.animSkip.addEventListener(MouseEvent.CLICK , mainscreenButtonHandler);

   init();

  }

  private function mainscreenButtonHandler(evt:MouseEvent):void {

   var btnName:String = evt.currentTarget.name;

   switch(btnName) {

    case "animSkip":

     targetMC.animSkip.removeEventListener(MouseEvent.CLICK , mainscreenButtonHandler);

     targetMC.animSkip.visible = false;

     targetMC.mainanimation.stop();

     targetMC.mainanimation.visible = false;

     targetMC.mainscreen.visible = true;

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 17, 2012

assign that button's visible property to false (or remove it from the  display list) when you play the main page.  remove the duplicate code from the button's handler.

Participant
September 17, 2012

unfortunately its all in the same frame just different layers. the button is at top and anywhere I change the status to false it is hidden at the beginning.

esdebon
Inspiring
September 17, 2012

is your animationa FLV? is a movie clip?

You can detect the end of the animation

if is it a movieClip try with this code in the last frame

MovieClip(parent).mainscreenButtonHandler(null);