Use flex to create a 100%-window transparent air program and package it into a. Air file.

Source: Internet
Author: User
Tags addchild

Step 1: Open flex3 to create a flex Project


 

Next, name and select the desktop application to run in air.


Automatic Production of xml configuration files

After the files are created, flex3 will automatically produce some files, and there will be two XML Description Languages in the SRC Folder:

The. mxml file is the foreground description file.

Some system configurations can be changed in. xml.

In this example, the air window is removed and the border of the air program is transparent.

 We open the airia_ex_login-app.xml file.

Find <systemjavasme> </systemjavasme> and <transparent> </transparent>

Change to the blue area.

<Systemcmdme> none </systemcmdme> indicates that no system window exists.

<Transparent> true </transparent> indicates that background transparency is enabled.


Note: Remove <! --> That is to say, the default file comment out the two items, and we will enable them now.

NOTE 2: This tutorial omitted the "Air UI design" Process in the case. The UI source file is included in the attachment.

 

This completes the first step. Run the command to check the result?

We found that flex has a default style shown. We need to remove it now.

Step 2: Configure "mx: windowedapplication" in the mxml File"

InMX: windowedapplicationTo remove the default flex style interface.

Showflexchrome = "false"
Alwaysinfront = "true"
Layout = "absolute"

Here we will set the page size.

Width = "314"
Height = "460"

Good! A perfect 100% transparent air run.

 

Maybe you will have a problem.

Can I drag a window on the desktop?

Can't I close or minimize it?

Please follow the next episode of the original airia.cn tutorial

 

 

Finally, all the source files, engineering files, and installation. Air files in this example are provided for you to download and reference. I forget that you have supported the development of airia.

 


Attachment:

 

 

Extension reference: Flex creates a user logon box (including a verification code)

<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute"
Fontsize = "12" horizontalalign = "center" creationcomplete = "Init ()">

<Mx: SCRIPT>
<! [CDATA [
Import MX. Controls. Alert;

Private function Init (): void {
Generate. Text = generatecheckcode ();
}

// Login identifying
Private function loginhandler (): void {
If (user. Text = "" | pass. Text = ""){
Alert. Show ("user or pass is empty", "Tips ");
} Else {
If (user. Text = "Shane" & pass. Text = "Shane"
& Identify. Text. tolowercase () = generate. Text. tolowercase ()){

Alert. Show ("login is OK", "Tips ");
Currentstate = "Hollow ";

} Else {
If (identify. Text. tolowercase ()! = Generate. Text. tolowercase ()){
Alert. Show ("indentifycode is error", "Tips ");
Generate. Text = generatecheckcode ();
} Else {
Alert. Show ("user or pass error", "Tips ");
}
}
}
}


// Clear
Private function clearhandler (): void {
User. Text = pass. Text = "";
}

// Generate identifying coder

Private function generatecheckcode (): String {
// Init
VaR num: number;
VaR code: string;
VaR checkcode: String = "";

For (var I: Int = 0; I <5; I ++ ){
Num = math. Round (math. Random () * 100000 );
If (Num % 2 = 0 ){
Code = string. fromcharcode (48 + (Num % 10 ));
} Else {
Code = string. fromcharcode (65 + (Num % 26 ));
}
Checkcode + = code;
}
Return checkcode;
}
]>
</MX: SCRIPT>

<Mx: Panel id = "Panel" x = "143" Y = "115" width = "350" Height = "229" layout = "absolute" Title = "login">
 
<Mx: button id = "btnlogin" x = "73" Y = "141" label = "login" Click = "loginhandler ()"/>
<Mx: button id = "btnclear" x = "167" Y = "141" label = "clear" Click = "clearhandler ()"/>

<Mx: Label x = "44" Y = "31" text = "user"/>
<Mx: Label x = "44" Y = "64" text = "pass"/>

<Mx: textinput id = "user" x = "81" Y = "31"/>
<Mx: textinput id = "pass" x = "81" Y = "62" displayaspassword = "true"/>
<Mx: Text x = "28" Y = "100" text = "identify"/>
<Mx: textinput x = "81" Y = "98" width = "50" id = "identify"/>
<Mx: Label x = "139" Y = "100" width = "48" id = "generate"/>
<Mx: Label x = "195" Y = "100" text = "you cannot see clearly ~~ "Click =" generatecheckcode () "/>

</MX: Panel>
 
<Mx: States>
<Mx: State name = "Hollow">
<Mx: removechild target = "{panel}"/>
<Mx: addchild position = "lastchild">
<Mx: Label text = "Hollow systane" x = "0" Y = "200" fontsize = "200" color = "red"/>
</MX: addchild>
</MX: State>
</MX: States>
 
</MX: Application>

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.