2 Replies Latest reply on Jul 6, 2009 10:07 AM by CannotCompute

    Removing a Style

    CannotCompute Level 1

      I need to figure out how to remove a style in flex.  Here is there issue that brings my questions about:

       

      I have a canvas container and depending on its size, i want to set the top, bottom, left and right properties to 10. If it is bigger than a certain size, I want to set the verticalCenter and horizontalCenter properties to 0. The problem comes about is vertical and horizontal styles take priority over top,bottom, left and right so I can not reset them.  Anyone have any ideas?

       

      TopBottom = (containerHeight-this.height)/2;

      LeftRight = (containerWidth-this.width)/2;

       

      if(TopBottom>10)

      {

      this.setStyle('verticalCenter',0);

      }

      else

      {

      this.setStyle('bottom',10);

      this.setStyle('top',10);

      }

       

      if(LeftRight>10)

      {

      this.setStyle('horizontalCenter',0);

      }

      else

      {

      this.setStyle('left',10);

      this.setStyle('right',10);

      }

        • 1. Re: Removing a Style
          CannotCompute Level 1

          Although this doesnt anwser my question, I got the effect I wanted by using the following code.

           

          TopBottom = (containerHeight-this.Building.height);

          LeftRight = (containerWidth-this.Building.width);

           

          if(TopBottom>10)

          {

          this.setStyle('bottom',TopBottom/2);

          this.setStyle('top',TopBottom/2);

          }

          else

          {

          this.setStyle('bottom',10);

          this.setStyle('top',10);

          }

           

          if(LeftRight>10)

          {

          this.setStyle('left',LeftRight/2);

          this.setStyle('right',LeftRight/2);

          }

          else

          {

          this.setStyle('left',10);

          this.setStyle('right',10);

          }

          • 2. Re: Removing a Style
            CannotCompute Level 1

            There is a clearStyle(styleProp:String) method.