2

I have an "intro" screen and I have a "play" screen.
As the intro screen starts it sets the play screen visible = false;

First the intro screen shows itself and the user has to press a button to go to the play screen, once the play screen shows itself actionscript moves a graphic from right to left.

The problem is that even when the play screen visible is false, it is still executing the actionscript (timers/enterframes etc)

is there some way to set the actionscript so that if self.visible==false dont play?

Please note that I am new to AS3/Flash and the code is in the movieclip itself not in a class.

3
  • What do you mean "screen"? What type of object is it? Commented Jul 7, 2013 at 14:23
  • Sorry, by screen I meant the player is first shown a movie clip called "intro" and sets the 2nd movieclip called "play" to false. This is for mobile using AIR so when I said screen, I meant the mobile screen. Commented Jul 7, 2013 at 14:26
  • Try to add the "play" to stage when needed, and call stop function of "play", remove it from stage when needn't, instead of setting visible value. Commented Jul 7, 2013 at 14:38

1 Answer 1

2

To do something totally automatically as you want it, you're best bet would be to extend the visible setter like so:

override public function set visible(value:Boolean):void
{
    if(value)
    {
        this.play();
    }
    else
    {
        this.stop();
    }
    super.visible = value;
}

that should go into your play screen's document class. If you're not using a document class this might work on the timeline.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.