Đang chuẩn bị liên kết để tải về tài liệu:
Flash Builder 4 and Flex 4 Bible- P4

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Flash Builder 4 and Flex 4 Bible- P4: 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 4 Understanding the Anatomy of a Flex Application Any code in the external file is compiled as part of the MXML file and the ActionScript class it represents but is executed after objects declared in MXML are instantiated so you can access these objects in your ActionScript code. Because the external file isn t in XML format you don t need to embed the Script element or the CDATA block inside the file to protect the code. Follow these steps to create an external ActionScript file 1. Choose File C- New ActionScript File from the Flash Builder menu. Don t select ActionScript Class that s a different sort of file I ll describe in a later chapter. 2. In the New ActionScript File dialog box select the folder in which you want to create the file. External ActionScript files can go anywhere in the project source-code root folder because you ll explicitly refer to the file s location when you link to it from an MXML file. I usually place the file in the same folder as the MXML file it s linked to. 3. Enter the name of the file. It should have a file extension of .as but the rest of the filename is up to you. For an application named HelloWorld.mxml the matching external ActionScript file would be helloWorld.as. 4. Click Finish to create the file. Note Notice that in this usage the external ActionScript filename starts with a lowercase character. This doesn t have any technical effect on the code but it s a way of indicating that it s a simple file containing ActionScript code as opposed to an ActionScript class which by object-oriented programming conventions has an initial uppercase character . After the file has been created you link to it from the MXML file with the fx Script element and add a source property pointing to the external file. The application in Listing 4.2 embeds its ActionScript code in an fx Script tag set. Caution Any particular fx Script element can contain nested ActionScript or use the source property to link to an external ActionScript file