Write Program code

Source: Internet
Author: User

Write Program code

To write the code for the "Hello World" program, edit the mxml file (airhelloworld. mxml) of the program, locate it in the project navigator view, and open it.

All flex air programs are included in the mxml javaswedapplication tag. It creates a simple window that only contains the title bar and the close button.

Add code

1. Add a title attribute to the javaswedapplication component and assign the attribute "Hello World ":

<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Export wedapplication xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" Title = "Hello World">

</MX: Using wedapplication>

2. Add a label component, set the text attribute to "Hello air", and set the alignment mode:

<? XML version = "1.0" encoding = "UTF-8"?> <? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Export wedapplication xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" Title = "Hello World">
<Mx: Label text = "Hello air" horizontalcenter = "0" verticalcenter = "0"/>
</MX: Using wedapplication>

3. Add the following style:

<Mx: style>
Application
{
Background-image :"";
Background-color :"";
Background-Alpha: "0.5 ";
}
</MX: style>

The style will be applied to the entire program, and the window background is a bit gray and transparent.

The complete code is as follows:

<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Export wedapplication xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" Title = "Hello World">
<Mx: style>
Application
{
Background-image :"";
Background-color :"";
Background-Alpha: "0.5 ";
}
</MX: style>
<Mx: Label text = "Hello air" horizontalcenter = "0" verticalcenter = "0"/>
</MX: Using wedapplication>

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.