Flex custom components-Use of the pop-up window [popupmanager titlewindow component]

Source: Internet
Author: User

Custom mxml component

The component-based development model is a feature of flex,ProgramAll mxml and as files are used as custom components.

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml"> </P> <p> <mx: titlewindow xmlns: MX = "http://www.adobe.com/2006/mxml" Title = "title window" <br/> width = "300" Height = "250"> </P> <p> <mx: SCRIPT> <br/> <! -- [CDATA [<br/> Import MX. controls. text; <br/> Import MX. managers. popupmanager; </P> <p> private var loginname: text; <br/> private var loggedin: Boolean; </P> <p> private function returnname (): void {<br/> loginname. TEXT = "name entered:"; <br/>}< br/> private function checklogin (): void {<br/>}< br/>] --> </P> <p> </MX: SCRIPT> <br/> <mx: hbox> <br/> <mx: Label text = "username"/> <br/> <mx: textinput name = "username" width = "100%"/> <br/> </MX: hbox> <br/> <mx: label text = "password"/> <br/> <mx: textinput id = "password" width = "100%"/> <br/> </MX: hbox> <br/> <mx: button label = "enter" Click = "checklogin ()"/> <br/> <mx: button label = "cancel" Click = "popupmanager. removepopup (this) "/> <br/> </MX: hbox> </P> <p> </MX: titlewindow> <br/> </MX: Application>

 

2: Create a main. mxml file.

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml"> </P> <p> <mx: button label = "create logon window" Click = "tologin () "/> <br/> <mx: SCRIPT> <br/> <! -- [CDATA [<br/> Import MX. managers. popupmanager; </P> <p> private function tologin (): void {<br/> var POP: popwnd = popwnd (popupmanager. createpopup (this, popwnd, true); </P> <p >}< br/>] --> <br/> </MX: SCRIPT> </P> <p> </MX: Application>

 

Popupmanager. createpopup (this, popwnd, true)

 

A pop-up window is created: popupmanager returns a variable of the iflexdisplayobject type. Therefore, a forced transformation is required and assigned to the popwnd variable.

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.