The following example shows how you can toggle the drop shadow on a Flex Panel container by setting the dropShadowEnabled style.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/19/toggling-the-drop-shadow-on-a-panel-container-in-flex/ -->
<mx:Application name="Panel_dropShadowEnabled_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:ApplicationControlBar dock="true">
<mx:CheckBox id="checkBox"
label="dropShadowEnabled:"
labelPlacement="left"
selected="true" />
</mx:ApplicationControlBar>
<mx:Panel id="panel"
title="Panel title"
width="100%"
height="100%"
borderColor="haloSilver"
dropShadowEnabled="{checkBox.selected}">
<mx:Label text="Panel contents" />
</mx:Panel>
</mx:Application>
View source is enabled in the following example.
You can also set the dropShadowEnabled style in an external .CSS file or <mx:Style /> block, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/19/toggling-the-drop-shadow-on-a-panel-container-in-flex/ -->
<mx:Application name="Panel_dropShadowEnabled_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Style>
Panel {
border-color: haloSilver;
dropShadowEnabled: false;
}
</mx:Style>
<mx:Panel id="panel"
title="Panel title"
width="100%"
height="100%">
<mx:Label text="Panel contents" />
</mx:Panel>
</mx:Application>
Or, you can set the dropShadowEnabled style using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/10/19/toggling-the-drop-shadow-on-a-panel-container-in-flex/ -->
<mx:Application name="Panel_dropShadowEnabled_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function checkBox_change(evt:Event):void {
panel.setStyle("dropShadowEnabled", checkBox.selected);
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:CheckBox id="checkBox"
label="dropShadowEnabled:"
labelPlacement="left"
selected="true"
change="checkBox_change(event);" />
</mx:ApplicationControlBar>
<mx:Panel id="panel"
title="Panel title"
width="100%"
height="100%"
borderColor="haloSilver">
<mx:Label text="Panel contents" />
</mx:Panel>
</mx:Application>

{ 1 comment… read it below or add one }
Why this web site do not have other languages support?