Repost flex Blog system developed from scratch Based on flex4 technology: 1 Development Environment configuration and hello World

Source: Internet
Author: User

Repost flex Blog system developed from scratch Based on flex4 technology: 1 Development Environment configuration and hello World

I. How to Learn flex well

The best way to learn technology is to learn and use it while reading the official documents and practice it in projects. However, official documents are too boring; if they are not included, they do not know where to start from the first project. If there is such a person, from his initial learning to his final learning, this process will be recorded one by one. It will be easier for others to learn along his trajectory.

For beginners, the learning content is too difficult to understand; if it is too easy, it will lose the interest and motivation of learning. Cookbook is a good example. There are many examples and you can find answers to any questions. However, cookbook only provides a set of answers to simple and single questions. It is loose and there is no connection between the question and the question. The solution to the problem is not very detailed and there is no specification to address. The project focuses on the overall architecture and standards. No project is as loose as a recipe. Cookbook can only be used as a dictionary for backup. Just as we cannot improve cultural literacy by memorizing dictionaries, learning flex technology cannot rely solely on cookbooks.

What if I read the official livedoc document without reading cookbook? From the beginning to one page, you can see the back and forget about it. It's just that you can't take a look at it. You just copy the example one by one, run it, change the parameters, and then you'll understand it. Remember it. However, if the document is vast, do you need to learn it in this way? Besides, not all classes are attached.CodeExample? There must be some knowledge points that are often used in projects, while the other part is for special situations and special problems. For Beginners, there is no need to cover all aspects, first, you can learn the most common and basic ones. What are the most common ones? Who can tell you?

In addition to reading cookbook and livedoc documentsProgramIt is also a good method. However, the structure of excellent open-source programs is often complicated and difficult for beginners to understand. If it is not complex, there is often no technical content, and it is not worth learning. The more comprehensive open-source programs are, the more difficult it is to understand, what is the design of the program like this, why is this class required, and why such an interface should be defined. All these problems have their own reasons. These reasons are lost in the evolution of historical versions, and it is difficult to see the leopard in the original version. If we can see how it evolved from the original model, it would be easier to understand its current architecture. Although most open-source programs have historical versions to check, as a mortal, who can find out all their versions, and then try to figure out the differences. Some people may write some research and analysis on this framework on the Internet, but hate is just a few words. Few people have fully analyzed a framework from the beginning to the end. It may be like a word. Most of the people who write analysis are a bottle of people who are less than half a bottle. The people who really know are actually silence.

I am a beginner in flex. From today on, I will start to learn flex4 technology and develop a flex Blog system. In addition, I will record my learning and development process in order to provide guidance to later users.

 

2. Configure the development environment

To write a flex program, you can use flex builder 3, flex builder 3 plugin for eclipse and flashdevelop. The first two are Adobe products and are charged (free for educators ), however, there is a 60-day trial period, which is open-source and free of charge. Of course, if you do not need ide encoding, the flex SDK is the best option. It is completely free, but it is not conducive to beginners. For beginners like me, I think it is more appropriate to use a visual ide coding environment.

Flex is used to write client code, and I plan to write it in Java on the server. Google App Engine provides Java support and is working on Web Testing servers. Thanks to Google for preparing such a free Java space for developers!

If I use flex and Java, I plan to install eclipse as my project development environment.

1. Use a Gmail account to apply for Google App Engine and apply for a Java environment license (as of the time the author wrote this blog post, Java environment support still needs to be applied. By default, only python is supported ), the application is pending for approval.
2. Install JDK 1.6
3. Install eclipse 3.4.2 and select for Java.
4. Adobe Flex builder 3.0.2 professional Eclipse plug-in
5. Install Google plugin for eclipse
6. Install flex SDK 4.0.0.4021, which is the max preview version. Set flex4.0 to the default SDK version.

The installation of the above software is relatively simple and will not be nonsense. If you are not clear about it, search for it in Google. Google plugin for eclipse contains GWT (Google Web Toolkit), which makes it easy for users to develop, debug, and deploy Google Apps. From the local deployment of applications to the remote end, you only need to click a button to complete the entire process of compilation and release.

 

3. The first hello World Application

1. Use eclispe to create a web application project named gapp_flexblog. The default namespace is sban. flexblog, which is used to write Java server code.
2. Create a new Flex project named gapp_flexblog_client. This project is used to compile client code.
3. Under the gapp_flexblog_client project, change the default homepage file to index. mxml. The content is as follows:

{
Function onclick ()
{
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ closed_text_224218 '). style. display = 'none'; document. getelementbyid ('Code _ open_image_224218 '). style. display = 'inline'; document. getelementbyid ('Code _ open_text_224218 '). style. display = 'inline ';
}
}
} "Align =" TOP "src =" http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif "width =" 11 "Height =" 16 "> {
Function onclick ()
{
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ open_text_224218 '). style. display = 'none'; getelementbyid ('Code _ closed_image_224218 '). style. display = 'inline'; getelementbyid ('Code _ closed_text_224218 '). style. display = 'inline ';
}
}
} "Align =" TOP "src =" http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif "width =" 11 "Height =" 16 "> Code
<? XML version = "1.0" encoding = "UTF-8" ?>
< Fxapplication Xmlns = "Http://ns.adobe.com/mxml/2009" >

<TextgraphicText= "Hello, world! " />

</Fxapplication>

 

This is a standard flex4 program file. The namespace of the flex4 mxml language is changed to the alias. Run this file. No problem:

Click deploy in the toolbar to release the application to the remote end. Access http://flex-blog.appspot.com/, one click OK:

Conclusion: This is a static Hello world application and cannot be called a real flex application. Real flex applications require data interaction with the server. In the next lesson, we will use urlloader to interact with the server.

Final source code for this lesson: lesson1.zip

Author: sban
Source: http://sban.cnblogs.com
The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent and Article The original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.
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.