Another example of something I 've seen lately on the Internet, so I thought I 'd build it in flex. this time I USEA titlewindow to display the status message of a login form. you can close the message by clicking the X button in the upper-right corner of the title window.
Note that there is no correct login. it will display the error message every time. in a future example I'll try and add some fancy fade in/out effects or resize effects on the error message to give it that proper "Web 2.0 feel"
<? XML version = "1.0" encoding = "UTF-8" ?>
<! -- Http://blog.flexexamples.com/2007/08/22/using-the-titlewindow-container-to-display-status-messages/ -->
< MX: Application Xmlns: MX = "Http://www.adobe.com/2006/mxml"
Layout = "Vertical"
Verticalalign = "Middle"
Backgroundcolor = "White" >
mx: style >
titlewindow {
cornerradius: 0;
backgroundcolor: red;
bordercolor: red;
borderalpha: 1.0;
}< br> mx: style >
mx: script >
private function showtitlewindow (): void {
titlewindow. height = 28;
}
Private function hidetitlewindow (): void {
Titlewindow. Height = 0;
}
]>
</MX: script>
< MX: vbox >
< MX: titlewindow ID = "Titlewindow"
Title = "Invalid username and/or password ."
Showclosebutton = "True"
Width = "100%"
Height = "0"
Close = "Hidetitlewindow ()" />
< MX: Form >
< MX: formitem Label = "Username :" >
< MX: textinput ID = "Username"
Maxchars = "24" />
</ MX: formitem >
< MX: formitem Label = "Password :" >
< MX: textinput ID = "Password"
Maxchars = "24"
Displayaspassword = "True" />
</ MX: formitem >
< MX: formitem >
< MX: button Label = "Login"
Click = "Showtitlewindow ()" />
</ MX: formitem >
</ MX: Form >
</ MX: vbox >
</MX: Application>
Reprinted from: http://www.cnblogs.com/taobataoma/archive/2008/01/11/1035794.html