One, how to learn Flex
The best way to learn technology is to learn to use it while reading the official document while practicing in the project. But the official document is too boring, and if no one takes it, it doesn't know where to start the project from scratch. If there is such a person, from his first study to the end of learning, the process is recorded, the other people along his track to learn, will be easier to get started.
For beginners, learning content if too difficult, difficult to understand, if too easy, and lost the interest and motivation to learn. Cookbook is very good, the example is very rich, no matter what question can find the answer. But cookbook just for simple, single problem solution set, very loose, there is no connection between the problem and the problem, the method of solving the problem is not very meticulous, there is no specification to speak. And the project is to pay attention to the overall structure, is to pay attention to norms. No project is as loose as a recipe. Cookbook can only be used as a dictionary standby. Just as we cannot improve our cultural attainments by reciting dictionaries, we cannot rely on cookbook to learn Flex technology.
What if you read the official Livedoc document without looking at cookbook? Look at the beginning of a page, see the back, the front also forget almost. Just so the superficial look, certainly not, so the example one by one copy out, run a look, change the parameters to see, slowly understand, remember also profound. But the document is like a cloud, does each class have to learn this way, and not all classes are accompanied by code samples? There must be some knowledge points in the project is often used, while the other part of the special situation is specific to the problem, for beginners, there is no necessarily exhaustive, first learned the most basic can be used. What are the most commonly used? Who can tell you?
In addition to reading cookbook and Livedoc documents, it's a good way to read open source programs. But the structure of excellent open source program is often more complex, beginners difficult to understand, not complex often and no technical content, it is not worth learning. The more perfect open source program, the more ugly to understand, what it will design, why there is this class, why to define such an interface, all these problems have its reasons. These reasons are lost in the evolution of the historical version, it is difficult to see the leopard from the original version. If we could see how it evolved from the original model, it would be easier to understand its architecture today. Although most open source programs have historical versions to check, but as mortal, who can investigate all of its version, and then carefully rub to compare to find out the difference. There are some people on the web who will write about the framework of the study, but hate is only a word, very few people to a framework from head to toe anatomy complete. Perhaps really as people say, write analysis of the person is a bottle of less than half a bottle of Bam, really understand people are silent.
I am a flex beginner, starting today, I will start to learn flex4 technology, while learning to develop a flex blog system. And I will be my study, the development process recorded, in order to give guidance to the successor.
Second, configure the development environment
Write Flex program, you can use Flex Builder 3,flex Builder 3 Plugin for Eclipse,flashdevelop, the first two are Adobe products, is charged (for educators are free), but there are 60 days probation, The latter is open source and free of charge. Of course, without IDE encoding, the Flex SDK is the best option, it's completely free, but it's not good for beginners. For beginners like me, I think I'm better off using a visual IDE coding environment.
Flex is used to write client-side code, the server I intend to write in Java. Google APP engine is open to Java support, just as a Web test server. Thanks to Google for creating such a nice free Java space for developers!
I am using flex with Java and I intend to install Eclipse as my project development environment.
1, the Gmail account to apply for Google App Engine, and the application of the Java Environment License (as the author wrote this blog, the support of the Java environment still need to apply, the default only Python support), the application needs to wait for approval.
2, install JDK 1.6
3, install Eclipse 3.4.2, select for Java version
4,adobe Flex Builder 3.0.2 Professional Eclipse Plug-in
5, install Google Plugin for Eclipse
6, install the Flex SDK 4.0.0.4021 version, which is the max preview version. Set flex4.0 as the default SDK version.
The above software installation is simpler, no longer one by one nonsense, if unknown, please search in Google. Google Plugin for Eclipse includes GWT (Google Web Toolkit), which makes it easy for users to develop, debug, and Google Apps. From the local application to the remote, you only need to click a button to complete the compilation, publishing the entire process.
Third, the first Hello World application
1, create a new Web application project with Eclispe, named Gapp_flexblog, and the default namespace is Sban.flexblog, which is used to write Java server-side code.
2, create a new Flex project named Gapp_flexblog_client, which is used to write client code.
3, under the Gapp_flexblog_client project, the default first page file is changed to Index.mxml, the contents are as follows:
<?xml version="1.0" encoding="utf-8"?>
<FxApplication xmlns="http://ns.adobe.com/mxml/2009">
<TextGraphic text="hello, world!" />
</FxApplication>
This is a standard flex4 program file. The namespace of the Flex4 Mxml language becomes http://ns.adobe.com/mxml/2009, and the prefix is no longer mx, but empty, one is differentiated from flex3 and the other is encoded conveniently. Run this file, no problem:
Click the Deploy button in the toolbar to publish the application to the remote. Visit http://flex-blog.appspot.com/, everything OK:
Conclusion: This is a static Hello World application and is not really a flex application. True flex applications require data interaction with the server side. In the next lesson we will use Urlloader to interact with the server.
The final source of this lesson: Lesson1.zip:http://sban.googlecode.com/svn/trunk/flex4_lessons/sources/lesson1.zip