5 Replies Latest reply on Sep 28, 2011 4:33 PM by kglad

    Before adding a new TF, remove any TF containing  "Type Here"

    Ron Colmen Level 2

      Code Below: Each time a button is clicked the code creates a new TF.

       

      By mistake if a user clicks the newTF_btn button more than once, How do I delete the previous TF? Basically I need to delete any TF which is not in use. (not in use = TF with "Type Here")

       

      newTF_btn.onRelease=function(){

          createTF(anchor_mc._x+tl.anchor_mc._width/2,anchor_mc._y,"");

      }

       

       

      function createTF(x:Number,y:Number,s:String):Void{

          if (tfNum_mc.tf.text == "Type Here") {

                      this._parent.removeMovieClip(); // not working

       

      var tfNum_mc:MovieClip = tl.attachMovie("tfID","tfNum_mc_",tl.getNextHighestDepth());

          tfNum_mc.tf.text=s;

          tfNum_mc.tf.border=true;

          tfNum_mc.tf.background = true;

          tfNum_mc.tf.backgroundColor = 0xffffff;

          tfNum_mc.tf.text="Type Here";

      }

      }

       

      Message was edited by: Ron Colmen