Customised status message for Alert control

22 01 2008

If you want to give customized status message {It will be shown on top-right instead of bottom-left} in an Alert window, you need to define the custom properties in a style tag.

<?xml version="1.0" encoding="utf-8"?>

<!-- giving colored status message of an alert control-->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="absolute"
	width="320"
	height="240"
	backgroundGradientColors="[#ffffff, #b0b0ff]"
	>

	<mx:Style>
		@font-face{
			src: local("Comic Sans MS");
			fontFamily: customFont;
		}
		Alert{
			statusStyleName: customStatus;
		}
		.customStatus{
			/*Here color as well as font properties are changed.*/
			color: #FF0000;
			fontFamily: customFont;
			fontSize: 15;
		}
	</mx:Style>

	<mx:Script>
		<![CDATA[
			import mx.controls.Alert;

			private var _alert:Alert

			private function showAlert():void{
				_alert = Alert.show("The Alert message goes here","Alert title.");

				_alert.status = "Status message";//status message!
			}
		]]>
	</mx:Script>

	<mx:Button label="Show Alert" y="116" x="109" click="showAlert()"/>

</mx:Application>

Actions

Information

2 responses

22 01 2008
Vava

Hi
it is nice to see someone learning flex. Such a powerful RIA tool . Isnt it? I am also on the learning curve and will be regularly visiting your blog.

Good Luck

Vava

17 01 2009
jason kenny

Just like you, I go forever with out reading RSS. My view is, if it’s important at all, It will hit my twitter stream.

Leave a comment