2 Replies Latest reply on Apr 15, 2014 7:15 AM by MatLac

    Removing an image I added

    MatLac Level 1

      I wrote these few lines as a way to import an image to a button:

       

      var image = this.getField("Button1");

      //option 1

      if (image.buttonPosition == position.textOnly){

      image.buttonPosition = position.iconOnly;

      image.buttonImportIcon();

      }

       

      //option 2

      else{

      var cResponse = app.alert("Do you want to erase the picture?", 2, 2);

      if (cResponse == "4"){

      image.buttonPosition = position.textOnly;

      }

      }

       

      Adding the image works fine but removing it is a little glitchy since the image is not really removed but more likely hidden when iconOnly becomes textOnly.  So if the user tries to add an image but changes its mind by pressing Cancel, buttonPosition is changed to iconOnly anyway and option 2 becomes prevalent.  Is there a way to set the button icon to "null" or get the "icon value" as my argument?