Flash Builder 4 and Flex 4 Bible- P5
Số trang: 50
Loại file: pdf
Dung lượng: 1.29 MB
Lượt xem: 21
Lượt tải: 0
Xem trước 5 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Flash Builder 4 and Flex 4 Bible- P5: When Macromedia first released Flash MX in 2002, the product was branded as the newway to build Rich Internet Applications (known by the acronym RIA). The term wasinvented at Macromedia to describe a new class of applications that would offer thebenefits 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 applicationssince the mid-1990s....
Nội dung trích xuất từ tài liệu:
Flash Builder 4 and Flex 4 Bible- P5 Chapter 6: Debugging Flex Applications FIGURE 6.4The Console view Preferences dialog box Terminating a debugging session You should always explicitly terminate a debugging session before trying to run or debug an appli- cation again. You can terminate a debugging session in many ways: l Choose Run ➪ Terminate from the Flash Builder menu. l As shown in Figure 6.5, click the square red Terminate button in the Console view. l Click the square red Terminate button in the Debug view (visible in the Flex Debugging perspective). l Close the browser in which the application is running (for a Web application). l Close the application (for a desktop application).TipWhen you terminate a Web application’s debugging session from within Flash Builder, the browser sometimescloses automatically, depending on which Web browser and operating system you’re using and whether anyother tabs or browser windows are open. For example, provided that no other sites are open, Internet Explorerand Firefox on Windows always close automatically. Firefox on the Mac doesn’t always close automatically.The fact that this behavior differs from one operating system to another is not a cause for concern. n 171Part I: Flex Fundamentals FIGURE 6.5The Console view’s Terminate button The Terminate button Using trace() and the Logging API With Flex, you can generate and send logging messages to Flash Builder and other logging targets at runtime. Tracing is typically useful when you’re trying to get runtime information about the following: l Variable values l The order of application execution l Whether various bits of code are being executed as expected In its simplest use, logging is accomplished through use of the trace() method. More advanced logging techniques are also available through an interface known as the Logging API. Using the trace() function The trace() function is global to Flash Player; that is, it’s always available without your having to reference or import an ActionScript class. The purpose of the trace() function is to send a text message to a logging target. In its simplest form, trace is called with a String value: trace(‘A tracing message’); You also can pass in variables and concatenated expressions that can result in a String: trace(“The value of myVariable is “ + myVariable); In fact, any object that can serialize to a String can be passed to trace(). In this example, an Array of String values is passed to trace(): trace([‘hello’, ‘world’]); Because the Array class is automatically serialized as a comma-delimited string, the resulting out- put message looks like this: hello,world172 Chapter 6: Debugging Flex Applications Trace messages in Flash Builder’s Console view When you debug a Flex application with Flash Builder, the value you pass into trace() is displayed in Flash Builder’s Console view.TipCalls to trace() are ignored when you run, rather than debug, an application even though the same debugversion of your application is being executed. These calls are also stripped from an application’s release version,so you can leave any calls to trace() in an application without affecting runtime performance or file size. n Try these steps to see the trace() function at work: 1. Create a new Flex application with the following code: 2. Click Debug, or press F11 (Windows) or Ô+F11 (Mac), to debug the application. 3. Click Call Trace in the application to call trace(). 4. Switch back to Flash Builder, and look at the Console view. As shown in Figure 6.6, you should see the tracing message displayed in the Console view. FIGURE 6.6 A tracing message in the Console view Tracing message in the Console view Sending tracing messages to flashlog.txt Messages also can be saved to a text file named flashlog.txt. The flashlog.txt file is cre- ated by the debugger version of Flash Player in a particular folder on your system. ...
Nội dung trích xuất từ tài liệu:
Flash Builder 4 and Flex 4 Bible- P5 Chapter 6: Debugging Flex Applications FIGURE 6.4The Console view Preferences dialog box Terminating a debugging session You should always explicitly terminate a debugging session before trying to run or debug an appli- cation again. You can terminate a debugging session in many ways: l Choose Run ➪ Terminate from the Flash Builder menu. l As shown in Figure 6.5, click the square red Terminate button in the Console view. l Click the square red Terminate button in the Debug view (visible in the Flex Debugging perspective). l Close the browser in which the application is running (for a Web application). l Close the application (for a desktop application).TipWhen you terminate a Web application’s debugging session from within Flash Builder, the browser sometimescloses automatically, depending on which Web browser and operating system you’re using and whether anyother tabs or browser windows are open. For example, provided that no other sites are open, Internet Explorerand Firefox on Windows always close automatically. Firefox on the Mac doesn’t always close automatically.The fact that this behavior differs from one operating system to another is not a cause for concern. n 171Part I: Flex Fundamentals FIGURE 6.5The Console view’s Terminate button The Terminate button Using trace() and the Logging API With Flex, you can generate and send logging messages to Flash Builder and other logging targets at runtime. Tracing is typically useful when you’re trying to get runtime information about the following: l Variable values l The order of application execution l Whether various bits of code are being executed as expected In its simplest use, logging is accomplished through use of the trace() method. More advanced logging techniques are also available through an interface known as the Logging API. Using the trace() function The trace() function is global to Flash Player; that is, it’s always available without your having to reference or import an ActionScript class. The purpose of the trace() function is to send a text message to a logging target. In its simplest form, trace is called with a String value: trace(‘A tracing message’); You also can pass in variables and concatenated expressions that can result in a String: trace(“The value of myVariable is “ + myVariable); In fact, any object that can serialize to a String can be passed to trace(). In this example, an Array of String values is passed to trace(): trace([‘hello’, ‘world’]); Because the Array class is automatically serialized as a comma-delimited string, the resulting out- put message looks like this: hello,world172 Chapter 6: Debugging Flex Applications Trace messages in Flash Builder’s Console view When you debug a Flex application with Flash Builder, the value you pass into trace() is displayed in Flash Builder’s Console view.TipCalls to trace() are ignored when you run, rather than debug, an application even though the same debugversion of your application is being executed. These calls are also stripped from an application’s release version,so you can leave any calls to trace() in an application without affecting runtime performance or file size. n Try these steps to see the trace() function at work: 1. Create a new Flex application with the following code: 2. Click Debug, or press F11 (Windows) or Ô+F11 (Mac), to debug the application. 3. Click Call Trace in the application to call trace(). 4. Switch back to Flash Builder, and look at the Console view. As shown in Figure 6.6, you should see the tracing message displayed in the Console view. FIGURE 6.6 A tracing message in the Console view Tracing message in the Console view Sending tracing messages to flashlog.txt Messages also can be saved to a text file named flashlog.txt. The flashlog.txt file is cre- ated by the debugger version of Flash Player in a particular folder on your system. ...
Tìm kiếm theo từ khóa liên quan:
thiết kế web giáo trình flash cơ bản kỹ năng cắt html photoshop căn bản giáo trình CS3Gợi ý tài liệu liên quan:
-
Báo cáo thực tập: Đề tài thiết kế Web
77 trang 568 2 0 -
Đề thi thực hành môn Thiết kế Web - Trường Cao đẳng nghề Vĩnh Phúc
3 trang 267 2 0 -
MỘT SỐ ĐIỂM CẦN CHÚ Ý KHI THIẾT KẾ WEB
5 trang 113 0 0 -
GIÁO TRÌNH LẬP TRÌNH WEB_PHẦN 2_BÀI 3
3 trang 103 0 0 -
Giáo trình Nhập môn thiết kế website
58 trang 83 0 0 -
Tài liệu giảng dạy Thiết kế giao diện Web - Trường CĐ Kinh tế - Kỹ thuật Vinatex TP. HCM
88 trang 72 0 0 -
81 trang 68 0 0
-
112 trang 64 0 0
-
Hướng dân sử dụng Navicat để Create , Backup , Restore Database
7 trang 63 0 0 -
Giáo trình môn Kỹ thuật vi điều khiển: Thiết kế web và vi điều khiển - Chương 2
39 trang 59 0 0