[Flex] Adobe Flex/air learning route (data in flex Part 1)

Source: Internet
Author: User

See: http://www.k-zone.cn/zblog/post/adobe-flex-air-traing-diagrams-data-1.html for details

The full text is as follows:
The article Adobe Flex/air learning route (Control in the flex part) introduces some experience in learning flex controls. Now I will start the second article in the Adobe Flex/air learning route series. This article focuses on how to learn its Data Reading and processing capabilities when learning flex. First of all to understand the following concepts: 1, xml I will not repeat here, please see: http://baike.baidu.com/view/63.htm (in fact, some of the functions of Baidu is relatively good, such as Encyclopedia, post it) 2. For more information about E4X, see Introduction to http://baike.baidu.com/view/1057001.htm. E4X makes it easier for us to process XML data. 3. For more information about JSON, see http://baike.baidu.com/view/136475.htm4#array. I think anyone who has learned programming should know the array concept. If not, please refer to here http://baike.baidu.com/view/209670.htm5?has table details please see: http://baike.baidu.com/view/329976.htm hash table and array directly different, it is not the content described in this article, if there are many this is not clear can refer to relevant information. Okay: After learning about the above content, let's take a look at how Flex processes external data. That is to say, try to master the following knowledge points. 1. Usage of urlloader and URLRequest. After understanding the usage of urlloader and URLRequest, you can read any data from the outside and process it. For example, the following code: var Loader: urlloader = new urlloader (New URLRequest ("Resources/config. XML "); loader. addeventlistener (event. complete, handlecompleted); the above Code tells us how Flex reads external XML. After reading the XML, You can process it. For details about the processing method, see the following. 2. Flex's XML processing mechanism. Since flex itself has a built-in E4X mechanism, it is more suitable for processing data such as XML than other programming languages. Therefore, you need to learn how Flex reads and controls XML. 3. Flex has some built-in class flex sdks related to XML that have some built-in classes for processing XML, and these classes are basically placed under the Flash. xml package. For example, xmldocument, xmlnode, and xmlnodetype flash. for more information about XML, see: The http://livedocs.adobe.com/flex/3_cn/langref/flash/xml/package-detail.html also contains two classes in the top-level package: XML: http://livedocs.adobe.com/flex/3_cn/langref/package.html#XML () xmllist: http://livedocs.adobe.com/flex/3_cn/langref/package.html#XMLList () and a class about processing the xmllist set: xmllistcollection, which is located in MX. collections below, please refer to the http://livedocs.adobe.com/flex/3_cn/langref/m X/collections/xmllistcollection.html after you have mastered the content, you can easily process the XML that is read into flex. 4. Since Flex is a programming language, array and arraycollection naturally have the ability to process arrays. Therefore, you must master some concepts of array in ActionScript 3.0. For example, length of an array, indexof and lastindexof an array, add new elements (push and unshift) at the beginning and end, and delete elements (POP and shift) at the beginning and end) insert/delete elements (SPLICE) in the array slice, connect multiple arrays (Concat), array sorting (reverse, sort, sorton), operations on array elements (foreach, every, filter, MAP, some) and other concepts I personally think that although the arrays of ActionScript 3.0 do have some ways that other languages do not have, however, the array of ctionscript 3.0 is much worse than that of other dynamic languages (Python and Ruby. Arraycollection is a more advanced method brought to us by ActionScript 3.0. The meaning of arraycollection is the set of arrays. In many ways, it can replace the unpleasant array concept in the ActionScript 3.0. For detailed usage, refer to the following: although notepad 3.0 does not provide us with the hash table function, we can use another powerful function of ActionScript 3.0: object class, we can implement the hash table function by controlling the object. For example, the following code: var OBJ: Object = new object (); obj. X = 1; obj. y = 2; obj. z = 3; if you want to retrieve obj. then we can use OBJ [x] Or obj. in this way, the corresponding value can be obtained. 6. JSON processing because many open API sources Support JSON output, you still need to know how to process JSON in flex. JSON has the following advantages over XML: 1. The size is relatively small. 2. It is easier to be processed by JavaScript. However, the WordPress 3.0 does not provide us with the ability to directly process JSON. Therefore, we need to use external power to implement it. In my frequently used flex tools and resources, I suggest a library: as3corelib. The class jsondecoder for processing JSON in ActionScript 3.0. For specific usage of this class, please search for it by yourself.

Okay, basically Adobe Flex/air learning route (data in flex Part 1) has been completed, but this is only the most basic data processing method in flex, next Article Adobe Flex/air learning route (data in flex Part II) I will introduce the data processing methods of flex components: dataprovider and itemrenderer. Through these two attributes, we can make some flex built-in components have data display and processing capabilities.

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.