3 Replies Latest reply on Dec 8, 2011 10:11 AM by Ned Murphy

    alpha property seems to be broken

    darian3118

      Sample code with hiliting is at:

      https://docs.google.com/document/d/15vTCG6-h5syr0kUqFvGyLcI2Nyap9WTMneitsv-RRwc/edit

       

      Is there a more effective way to consistently show and hide a textfield? or is there a smarter class to use like MovieClip or Sprite?  I've tried all 3 and it's giving me strange behavior.

       

      This configuration of the two functions shows the message box once, but fails to hide.

       

                public  function hideMsgBox():void{

        trace("hiding msgBox");

                                    msgBox.visible = false;

                                    msgBox.alpha = 0;

        //removeChild(msgBox);

        //hack

        //msgBox.x = 1000000;

        //msgBox.copy.text = "";

        // why is none of this working?

        //msgBox = null;

        //msgBox.visible = false;

        //removeChild(msgBox);

                          }

       

       

                          public function showMsgBox(msg:String):void{

        //msgBox = MessageBox.getInstance();

                                    msgBox.alpha = 1;

                                    msgBox.visible = true;

       

        trace("showMsg: "+msg);

                                    msgBox.copy.text = msg;

                                    msgBox.y = 150;

                                    msgBox.x = 150;

                                    msgBox.copy.width = 250;

                                    msgBox.copy.height = 50;

                                    msgBox.mouseEnabled = false;

                                    addChild(msgBox);

                          }

       

       

       

      Alternatively if I don’t set the alpha in showMsg it show once, hides once, but fails to show again.  It’s like alpha can only be changed once and then it fails to change after that:

       

                          public  function hideMsgBox():void{

        trace("hiding msgBox");

                                    msgBox.visible = false;

                                    msgBox.alpha = 0;

        //removeChild(msgBox);

        //hack

        //msgBox.x = 1000000;

        //msgBox.copy.text = "";

        // why is none of this working?

        //msgBox = null;

        //msgBox.visible = false;

        //removeChild(msgBox);

                          }

       

       

                          public function showMsgBox(msg:String):void{

        //msgBox = MessageBox.getInstance();

        //          msgBox.alpha = 1;

                                    msgBox.visible = true;

       

        trace("showMsg: "+msg);

                                    msgBox.copy.text = msg;

                                    msgBox.y = 150;

                                    msgBox.x = 150;

                                    msgBox.copy.width = 250;

                                    msgBox.copy.height = 50;

                                    msgBox.mouseEnabled = false;

                                    addChild(msgBox);

                          }