tailieunhanh - Flash Builder 4 and Flex 4 Bible- P17
Flash Builder 4 and Flex 4 Bible- P17: When Macromedia first released Flash MX in 2002, the product was branded as the new way to build Rich Internet Applications (known by the acronym RIA). The term was invented at Macromedia to describe a new class of applications that would offer the benefits of being connected to the Internet, including access to various types of Web-based services, but would solve many of the nagging issues that had been inherent in browser-based applications since the mid-1990s | Chapter 24 Managing XML with E4X If you want to identify namespaces by their URI use the ActionScript s namespace keyword to create a namespace object by the URI private namespace train http train private namespace plane http airplane private namespace car http automobile Alternatively if you want to identify namespaces by their prefixes as assigned in the XML structure create variables typed as the Namespace class. Assign each namespace by calling the XML object s namespace method and passing the selected namespace prefix private var train Namespace private var plane Namespace private var car Namespace train plane car Note The Namespace class is a top-level Flash Player class meaning that it isn t a member of any particular package and can be used without requiring an import statement. Tip Notice that the names of the ActionScript namespace objects match the namespace prefixes in the XML content. This isn t technically necessary as long as the namespace Uniform Resource Identifier URI or prefix match XML elements will be identified correctly. But consistency between data and code notation certainly doesn t hurt. After the namespace objects have been declared you can use them as element and attribute prefixes in E4X expressions. The namespace object s name is separated from the element or attribute name with the operator to qualify the node as being a member of the selected namespace. The following code extracts the traveltime element that s qualified with the plane namespace traveltime traveltime The application in Listing declares an XML structure and then enables the user to indicate which of the three traveltime values she wants to see. LISTING Using XML namespaces in E4X xml version encoding utf-8 s Application xmlns fx http mxml 2009 xmlns s library flex spark xmlns mx library .
đang nạp các trang xem trước