1 Reply Latest reply on Oct 22, 2009 3:25 PM by KenichiM

    Is there a way for properties of a mask to be data binded or use constraints?

    KenichiM

      It doesn't seem the properties of a mask, such as width or height, adjust based on databinding or the dimensions of the mask adjust based on its constrainits.  Maybe I'm missing something.  What I'm trying to do is basically skin a 20 pixel thick border of a <s:Group> but without having to write a custom border skin.  Here is my mxml:

       

      <s:Group>

          <s:Rect left="0" right="0" top="0" bottom="10" radiusX="15" radiusY="15" alpha=".23">
              <s:mask>
                  <s:Graphic>
                      <s:Rect x="0" y="0" height="20" width="{width}">
                          <s:fill>
                              <mx:SolidColor color="#0" />
                          </s:fill>
                      </s:Rect>
                      <s:Rect x="0" y="0" width="20" height="{height}">
                          <s:fill>
                              <mx:SolidColor color="#0" />
                          </s:fill>
                      </s:Rect>
                      <s:Rect x="{width-20}" y="0" width="20" height="{height}">
                          <s:fill>
                              <mx:SolidColor color="#0" />
                          </s:fill>
                      </s:Rect>
                      <s:Rect x="0" bottom="10" height="20" width="{width}">
                          <s:fill>
                              <mx:SolidColor color="#0" />
                          </s:fill>
                      </s:Rect>
                  </s:Graphic>
              </s:mask>
              <s:fill>
                  <mx:SolidColor color="#ff0000" />
              </s:fill>
          </s:Rect>

           ... child elements  

      </s:Group>

       

      This work until the height of the Group changes. Then the dimension of the mask remains the same while the size of the container changes.

        • 1. Re: Is there a way for properties of a mask to be data binded or use constraints?
          KenichiM Level 1

          I found a way to do it without a mask but it would still be good info to know if properites of a mask can be data binded.  Here is how to do it without a mask:

           

              <s:Border x="30" y="60" width="600" height="600" backgroundAlpha="0">
                  <s:borderStroke>
                          <mx:SolidColorStroke
                               alpha=".23"
                              color="#ff0000"
                              weight="20"/>            
                  </s:borderStroke>
              </s:Border>