If statement not working

Hi,

anyone know why my “if” statement isnt working inside of the CLICK function? i have this working in another script by adding a “on complete” listener to the intro animation, but would prefer not to do this as i trying to cut down on script & having the “if” statement inside the click function would save me loads of scripting elsewhere…

package {
    import flash.events.*;
    import flash.display.*;
    import flash.text.*;

    public class buttons extends MovieClip {
        
        private var btn1:MovieClip = new Btn();
        private var btn2:MovieClip = new Btn();
        private var btn3:MovieClip = new Btn();
        private var btn4:MovieClip = new Btn();
        private var btn5:MovieClip = new Btn();
        private var Intro:MovieClip;
        


        public function buttons() {
            
            addChild(btn1);
            btn1.x = 20;
            btn1.y = 20;
            btn1.myText.text = "ENTER BUTTON";
            btn1.addEventListener (MouseEvent.CLICK, btn1Clicked);
            
            Intro = new intro();
            Intro.x = 50;
            Intro.y = 50;
            
            btn2.x = 20;
            btn2.y = 60;
            btn2.myText.text = "MENU1 BUTTON";
            
            btn3.x = 20;
            btn3.y = 100;
            btn3.myText.text = "MENU2 BUTTON";
            
            btn4.x = 20;
            btn4.y = 140;
            btn4.myText.text = "MENU3 BUTTON";
            
            btn5.x = 20;
            btn5.y = 180;
            btn5.myText.text = "HOME BUTTON";

        }
        
        public function btn1Clicked (Event:MouseEvent):void{
            trace ("enter button clicked");
            removeChild (btn1);
            addChild(Intro);
            if(Intro.currentFrame == 50) {
                removeChild(Intro);
                addChild (btn2);
                addChild (btn3);
                addChild (btn4);
                addChild (btn5);
                }
        }
    }
}

The Intro movieclip is created inside the function that creates the buttons.

Presumably Intro starts playing as soon as it’s created?

Is it possible that by the time you click one of the buttons, Intro has already gone past frame 50?

Why would you expect it to be on that particular frame when someone clicks a button?

Couldn’t you put code in the last frame of the Intro clip, to put the menu buttons on
stage and to delete the Intro clip?

Hi DiamondDog,

thanks for your reply. I think i’ve sorted the problem now by approaching the problem differently so dont need the if statement within the function call, but thanks for your suggestions anyway.