Flex pop-up window

Source: Internet
Author: User

References: http://help.adobe.com/en_US/flex/using/WS6c678f7b363d5da52e8f1ca1124a0430dcf-8000.html

 

Pop-up code
<? XML version = "1.0"?> <! -- Containers \ spark \ mycomponents \ myloginform. mxml --> <s: titlewindow xmlns: FX = "http://ns.adobe.com/mxml/2009" xmlns: MX = "Library: // ns.adobe.com/flex/mx" xmlns: S = "Library: // ns.adobe.com/flex/spark "Close =" handlecloseevent (); "> <s: layout> <s: verticallayout/> </S: layout> <FX: SCRIPT> <! [CDATA [import MX. managers. popupmanager; // handle the close button and cancel button. private function handlecloseevent (): void {popupmanager. removepopup (this);} // handle the OK button. private function processlogin (): void {// check credentials (not shown) then remove pop up. popupmanager. removepopup (this);}]> </FX: SCRIPT> <s: Form> <s: formitem label = "User Name"> <! -- Get the elements of the parent program --> <s: textinput id = "username" width = "100%" text = "{parentapplication. login. label} "/> </S: formitem> <s: formitem label =" password "> <s: textinput id = "password" displayaspassword = "true" width = "100%"/> </S: formitem> </S: Form> <s: hgroup> <s: button label = "OK" Click = "processlogin ();"/> <s: button label = "cancel" Click = "handlecloseevent ();"/> </s: hgroup> </S: titlewindow>
Main program code
<S: Application xmlns: FX = "http://ns.adobe.com/mxml/2009" xmlns: MX = "Library: // ns.adobe.com/flex/mx" xmlns: S = "Library: // ns.adobe.com/flex/spark"> <s: layout> <s: verticallayout/> </S: layout> <FX: SCRIPT> <! [CDATA [import learning. component. loginpopupwindow; // The bullet box component has been introduced to import MX. managers. popupmanager; import spark. components. titlewindow; [Bindable]/* after binding, You can bind the attributes in loginpopupwindow with the attributes on this page */Public var loginwindow: loginpopupwindow; // the pop-up window private function showlogin (): void {// convert the iflexdisplayobject interface returned by createpopup to the loginpopupwindow type loginwindow = loginpopupwindow (popupmanager. createpopup (this, loginpopupwindow, True); loginwindow. X = 300; loginwindow. y = 200; // The main program adds the title loginwindow to the pop-up box. title = "Enter login information"; // make title bar slightly transparent. loginwindow. setstyle ("borderalpha", 0.9); // hide the close button. loginwindow. closebutton. visible = false ;}]]> </FX: SCRIPT> <s: vgroup width = "300" Height = "300"> <s: button id = "login" label = "login" Click = "showlogin ();"/> <! -- Get the value in the pop-up window --> <s: textinput text = "{loginwindow. username. Text}"/> </S: vgroup> </S: Application>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.