Toggling the drop shadow on the Spark Panel container in Flex 4

The following example shows how you can toggle the drop shadow on a Spark Panel container by setting the Boolean dropShadowVisible style.

Full code after the jump.

This example requires Flex SDK 4.0.0.10007 or later.

The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see www.adobe.com/products/flex/. To download the latest nightly build of the Flex 4 SDK, see opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4.

For more information on getting started with Flex 4 and Flash Builder 4, see the official Adobe Flex Team blog.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/09/07/toggling-the-drop-shadow-on-the-spark-panel-container-in-flex-4/ -->
<s:Application name="Spark_Panel_dropShadowVisible_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        backgroundColor="haloSilver">
    <s:controlBarContent>
        <s:CheckBox id="checkBox"
                label="dropShadowVisible"
                selected="true" />
    </s:controlBarContent>
 
    <s:Panel id="pnl"
            title="Spark Panel title"
            dropShadowVisible="{checkBox.selected}"
            width="300" height="200"
            horizontalCenter="0" verticalCenter="0">
        <s:Scroller width="100%" height="100%">
            <s:Group>
                <s:Label id="lbl"
                        width="100%"
                        textAlign="justify"
                        paddingLeft="5" paddingRight="5"
                        paddingTop="5" paddingBottom="5">
                    <s:text><fx:String source="lorem.txt" /></s:text>
                </s:Label>
            </s:Group>
        </s:Scroller>
    </s:Panel>
 
</s:Application>

This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.

2 thoughts on “Toggling the drop shadow on the Spark Panel container in Flex 4

    1. @brett coffin,

      To remove the border, set the Boolean borderVisible style to false, as seen in the following example:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark">
          <s:controlBarContent>
              <s:CheckBox id="chckBx1" label="borderVisible" />
              <s:CheckBox id="chckBx2" label="dropShadowVisible" />
          </s:controlBarContent>
       
          <s:Panel id="pnl"
                  borderVisible="{chckBx1.selected}"
                  dropShadowVisible="{chckBx2.selected}"
                  width="300" height="200"
                  horizontalCenter="0" verticalCenter="0" />
       
      </s:Application>

      Peter

Comments are closed.