0

I want to click on the button "choose1" then button will disappear and the next is to add a button. I would like to make two requests in a click event of the button "choose1".

EDIT: this is my code

import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Stage;

public class Bo extends MovieClip
{

    var choose1:Choose;



    public function Bo()
    {
        // constructor code
        choose1=new Choose();
        addChild(choose1);
        choose1.addEventListener(MouseEvent.CLICK,clickChoose);
    }

    function clickChoose(e:MouseEvent):void
    {


        for (var i:Number=stage.numChildren -1; i>=0; i--)
        {
            stage.removeChildAt(i);
            //stage.getChildAt(i).visible = false;
        }

        var ex:Next=new Next();// add new button
        addChild(ex);
        //this.stage.removeEventListener(MouseEvent.CLICK,clickChoose);
    }


}

anyone can help me? thanks.

1 Answer 1

0

Removing a button after click is bad UX, consider adding whichever button you want but keeping the old one.

3
  • I've tried to hide the button and add a new button, but the button does not appear. "stage.getChildAt (i). visible = false;" Dec 23, 2012 at 15:20
  • Btw, it is also a bad habit to use lowercase name for class name. Your for loop is also strange, why do you need to have two conditions about i?
    – Jeremy D
    Dec 23, 2012 at 16:58
  • I had to edit the code for easy view. About loop "for" I do not find it unusual at all. Thanks Dec 24, 2012 at 5:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.