ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers (Paperback)
暫譯: ActionScript 3.0 食譜:Flash 平台與 Flex 應用程式開發者的解決方案 (平裝本)
Joey Lott, Darron Schall, Keith Peters
- 出版商: O'Reilly
- 出版日期: 2006-10-31
- 定價: $1,380
- 售價: 5.0 折 $690
- 語言: 英文
- 頁數: 588
- 裝訂: Paperback
- ISBN: 0596526954
- ISBN-13: 9780596526955
-
相關分類:
ActionScript & FLASH
立即出貨 (庫存 < 4)
買這商品的人也買了...
-
$420$328 -
$700$686 -
$880$695 -
$1,260$1,197 -
$880$695 -
$780$663 -
$680$578 -
$650$507 -
$550$429 -
$550$468 -
$980$774 -
$650$507 -
$520$442 -
$680$537 -
$720$569 -
$2,200$2,090 -
$1,200$948 -
$700$630 -
$900Advanced ActionScript 3 with Design Patterns (Paperback)
-
$580$493 -
$620$490 -
$350$298 -
$880$695 -
$990$891 -
$600$480
相關主題
商品描述
Description
Well before Ajax and Microsoft's Windows Presentation Foundation hit the scene, Macromedia offered the first method for building web pages with the responsiveness and functionality of desktop programs with its Flash-based "Rich Internet Applications". Now, new owner Adobe is taking Flash and its powerful capabilities beyond the Web and making it a full-fledged development environment.
Rather than focus on theory, the ActionScript 3.0 Cookbook concentrates on the practical application of ActionScript, with more than 300 solutions you can use to solve a wide range of common coding dilemmas. You'll find recipes that show you how to:
- Detect the user's Flash Player version or their operating system
- Build custom classes
- Format dates and currency types
- Work with strings
- Build user interface components
- Work with audio and video
- Make remote procedure calls using Flash Remoting and web services
- Load, send, and search XML data
- And much, much more ...
Each code recipe presents the Problem, Solution, and Discussion of how you can use it in other ways or personalize it for your own needs, and why it works. You can quickly locate the recipe that most closely matches your situation and get the solution without reading the whole book to understand the underlying code. Solutions progress from short recipes for small problems to more complex scripts for thornier riddles, and the discussions offer a deeper analysis for resolving similar issues in the future, along with possible design choices and ramifications. You'll even learn how to link modular ActionScript pieces together to create rock-solid solutions for Flex 2 and Flash applications.
When you're not sure how ActionScript 3.0 works or how to approach a specific programming dilemma, you can simply pick up the book, flip to the relevant recipe(s), and quickly find the solution you're looking for.
Table of Contents
Preface
1. ActionScript Basics
1.1 Creating an ActionScript Project
1.2 Customizing the Properties of an Application
1.3 Where to Place ActionScript Code
1.4 How to Trace a Message
1.5 Handling Events
1.6 Responding to Mouse and Key Events
1.7 Using Mathematical Operators
1.8 Checking Equality or Comparing Values
1.9 Performing Actions Conditionally
1.10 Performing Complex Conditional Testing
1.11 Repeating an Operation Many Times
1.12 Repeating a Task over Time
1.13 Creating Reusable Code
1.14 Generalizing a Method to Enhance Reusability
1.15 Exiting a Method
1.16 Obtaining the Result of a Method
1.17 Handling Errors
2. Custom Classes
2.1 Creating a Custom Class
2.2 Determining Where to Save a Class
2.3 Creating Properties That Behave As Methods
2.4 Creating Static Methods and Properties
2.5 Creating Subclasses
2.6 Implementing Subclass Versions of Superclass Methods
2.7 Creating Constants
2.8 Dispatching Events
3. Runtime Environment
3.1 Detecting the Player Version
3.2 Detecting the Operating System
3.3 Checking the Player Type
3.4 Checking the System Language
3.5 Detecting Display Settings
3.6 Scaling the Movie
3.7 Changing the Alignment
3.8 Hiding the Flash Player's Menu Items
3.9 Detecting the Device's Audio Capabilities
3.10 Detecting the Device's Video Capabilities
3.11 Prompting the User to Change Player Settings
3.12 Dealing with System Security
4. Numbers and Math
4.1 Representing Numbers in Different Bases
4.2 Converting Between Different Number Systems
4.3 Rounding Numbers
4.4 Inserting Leading or Trailing Zeros or Spaces
4.5 Formatting Numbers for Display Without a Mask
4.6 Formatting Currency Amounts
4.7 Generating a Random Number
4.8 Simulating a Coin Toss
4.9 Simulating Dice
4.10 Simulating Playing Cards
4.11 Generating a Unique Number
4.12 Converting Angle Measurements
4.13 Calculating the Distance Between Two Points
4.14 Determining Points Along a Circle
4.15 Converting Between Units of Measurement
5. Arrays
5.1 Adding Elements to the Start or End of an Array
5.2 Looping Through an Array
5.3 Searching for Matching Elements in an Array
5.4 Removing Elements
5.5 Inserting Elements in the Middle of an Array
5.6 Converting a String to an Array
5.7 Converting an Array to a String
5.8 Creating a Separate Copy of an Array
5.9 Storing Complex or Multidimensional Data
5.10 Sorting or Reversing an Array
5.11 Implementing a Custom Sort
5.12 Randomizing the Elements of an Array
5.13 Getting the Minimum or Maximum Element
5.14 Comparing Arrays
5.15 Creating an Associative Array
5.16 Reading Elements of an Associative Array
6. Display List
6.1 Adding an Item to the Display List
6.2 Removing an Item from the Display List
6.3 Moving Objects Forward and Backward
6.4 Creating Custom Visual Classes
6.5 Creating Simple Buttons
6.6 Loading External Images at Runtime
6.7 Loading and Interacting with External Movies
6.8 Creating Mouse Interactions
6.9 Dragging and Dropping Objects with the Mouse
7. Drawing and Masking
7.1 Setting a Line Style
7.2 Setting Gradient Line Styles
7.3 Drawing a Line
7.4 Drawing a Curve
7.5 Drawing an Arc
7.6 Drawing a Rectangle
7.7 Drawing a Circle
7.8 Drawing an Ellipse
7.9 Drawing a Triangle
7.10 Drawing Regular Polygons
7.11 Drawing a Star
7.12 Filling a Shape with a Solid or Translucent Color
7.13 Filling a Shape with a Gradient
7.14 Filling a Shape with a Bitmap
7.15 Scripting Masks
8. Bitmaps
8.1 Creating a BitmapData Object
8.2 Adding a Bitmap to the Display List
8.3 Drawing a Display Object to a Bitmap
8.4 Loading an External Image into a Bitmap
8.5 Manipulating Pixels
8.6 Creating Rectangular Fills
8.7 Creating a Flood Fill
8.8 Copying Pixels
8.9 Copying Channels
8.10 Creating Noise
8.11 Creating Perlin Noise
8.12 Using Threshold
8.13 Applying a Filter to a Bitmap
8.14 Dissolving Between Two Bitmaps
8.15 Scrolling a Bitmap
9. Text
9.1 Creating an Outline Around a Text Field
9.2 Creating a Background for a Text Field
9.3 Making a User Input Field
9.4 Making a Password Input Field
9.5 Filtering Text Input
9.6 Setting a Field's Maximum Length
9.7 Displaying Text
9.8 Displaying HTML-Formatted Text
9.9 Condensing Whitespace
9.10 Sizing Text Fields to Fit Contents
9.11 Scrolling Text Programmatically
9.12 Responding to Scroll Events
9.13 Formatting Text
9.14 Formatting User-Input Text
9.15 Formatting a Portion of Existing Text
9.16 Setting a Text Field's Font
9.17 Embedding Fonts
9.18 Creating Text That Can Be Rotated
9.19 Displaying Unicode Text
9.20 Assigning Focus to a Text Field
9.21 Selecting Text with ActionScript
9.22 Setting the Insertion Point in a Text Field
9.23 Responding When Text Is Selected or Deselected
9.24 Responding to User Text Entry
9.25 Adding a Hyperlink to Text
9.26 Calling ActionScript from Hyperlinks
9.27 Working with Advanced Text Layout
9.28 Applying Advanced Anti-Aliasing
9.29 Replacing Text
9.30 Retrieving a List of System Fonts
10. Filters and Transforms
10.1 Applying Color Changes
10.2 Applying Color Tints
10.3 Resetting Color
10.4 Shearing
10.5 Applying Basic Filters
10.6 Applying Advanced Filter Effects (Emboss, etc.)
10.7 Embossing
10.8 Detecting Edges
10.9 Sharpening
10.10 Making a Digital Negative
10.11 Applying Grayscale
10.12 Changing Saturation
10.13 Changing Brightness
10.14 Changing Contrast
11. Programmatic Animation
11.1 Moving an Object
11.2 Moving an Object in a Specific Direction
11.3 Easing
11.4 Acceleration
11.5 Springs
11.6 Using Trigonometry
11.7 Applying Animation Techniques to Other Properties
12. Strings
12.1 Joining Strings
12.2 Using Quotes and Apostrophes in Strings
12.3 Inserting Special Whitespace Characters
12.4 Searching for a Substring
12.5 Extracting a Substring
12.6 Parsing a String into Words
12.7 Removing and Replacing Characters and Words
12.8 Retrieving One Character at a Time
12.9 Converting Case
12.10 Trimming Whitespace
12.11 Reversing a String by Word or by Character
12.12 Converting Between Strings and Unicode or ASCII
13. Regular Expressions
13.1 Understanding Regular Expression Patterns
13.2 Testing Regular Expressions
13.3 Looking for Pattern Matches
13.4 Removing and Replacing Characters and Words Using Patterns
13.5 Creating a Nongreedy Pattern
13.6 Validating User Input with Common Patterns
14. Dates and Times
14.1 Finding the Current Date and Time
14.2 Retrieving the Date Values
14.3 Retrieving the Day or Month Name
14.4 Formatting the Date and Time
14.5 Formatting Seconds or Milliseconds as Minutes and Seconds
14.6 Converting Between DMYHMSM and Epoch Milliseconds
14.7 Using Timers
14.8 Calculating Elapsed Time or Intervals Between Dates
14.9 Parsing a Date from a String
15. Programming Sound
15.1 Creating a Sound Object and Loading a Sound
15.2 Starting and Stopping a Sound
15.3 Setting the Buffer for a Sound
15.4 Offsetting the Start of a Sound
15.5 Playing a Sound Multiple Times (Looping)
15.6 Getting the Size of a Sound File
15.7 Reading the ID3 Tag of a Sound File
15.8 Find Out When a Sound Finishes Playing
15.9 Tracking the Progress of a Playing Sound
15.10 Pausing and Restarting a Sound
15.11 Reading the Level of a Sound
15.12 Stopping All Sounds
15.13 Reading the Sound Spectrum
15.14 Changing the Volume or Pan of a Sound
15.15 Creating a Sound Application
16. Video
16.1 Loading and Playing Back Video
16.2 Controlling Video Sound
16.3 Reading Playback Time
16.4 Reading Video Duration
16.5 Controlling Playback Time
16.6 Scaling Video
16.7 Managing and Monitoring Buffering and Loading
16.8 Listening for Cue Points
16.9 Applying Filters to Video
16.10 Pausing and Resuming Video
16.11 Stopping Video
16.12 Scrubbing Video
16.13 Clearing the Video Display
16.14 Determining User Bandwidth
17. Storing Persistent Data
17.1 Creating and Opening a Local Shared Object
17.2 Writing Data to a Shared Object
17.3 Saving a Local Shared Object
17.4 Reading Data from a Shared Object
17.5 Removing Data from a Shared Object
17.6 Serializing Custom Classes
17.7 Sharing Data Between Flash Applications
17.8 Controlling the Size of Local Shared Objects
18. Communicating with Other Movies
18.1 Creating Local Connections
18.2 Sending Data
18.3 Validating Receipt of Communication over Local Connections
18.4 Accepting Local Communications from Other Domains
19. Sending and Loading Data
19.1 Loading Variables from a Text File
19.2 Loading Variables from a Server-Side Script
19.3 Loading a Block of Text (Including HTML and XML)
19.4 Checking Load Progress
19.5 Accessing Data Being Downloaded
19.6 Sending Data to a Server-Side Script
19.7 Sending Variables and Handling a Returned Result
20. XML
20.1 Understanding XML Structure (Reading and Writing XML)
20.2 Creating an XML Object
20.3 Adding Elements to an XML Object
20.4 Adding Text Nodes to an XML Object
20.5 Adding Attributes to an XML Element
20.6 Reading Elements in an XML Tree
20.7 Finding Elements by Name
20.8 Reading Text Nodes and Their Values
20.9 Reading an Element's Attributes
20.10 Removing Elements, Text Nodes, and Attributes
20.11 Loading XML
20.12 Loading XML from Different Domains
20.13 Sending XML
20.14 Searching XML
20.15 Using HTML and Special Characters in XML
21. Web Services and Flash Remoting
21.1 Calling Web Services Methods
21.2 Handling Web Services Responses
21.3 Handling Web Services Errors
21.4 Calling Flash Remoting Methods
21.5 Handling Flash Remoting Responses
22. Building Integrated Applications
22.1 Calling JavaScript Functions
22.2 Calling ActionScript Functions
22.3 Passing Parameters from HTML
23. File Management
23.1 Downloading Files
23.2 Detecting When a User Selects a File to Upload
23.3 Monitoring Download Progress
23.4 Browsing for Files
23.5 Filtering Files That Display in the Browser Window
23.6 Detecting When the User Has Selected a File to Upload
23.7 Uploading Files
23.8 Monitoring File Upload Progress
24. Socket Programming
24.1 Connecting to a Socket Server
24.2 Sending Data
24.3 Receiving Data
24.4 Handshaking with a Socket Server
24.5 Disconnecting from a Socket Server
24.6 Handling Socket Errors
Appendix. Unicode Escape Sequences for Latin 1 Characters
Index
商品描述(中文翻譯)
**描述**
在 Ajax 和微軟的 Windows Presentation Foundation 出現之前,Macromedia 提供了第一種方法,利用基於 Flash 的「豐富網際網路應用程式」來構建具有桌面程式響應性和功能的網頁。現在,新的擁有者 Adobe 正在將 Flash 及其強大的功能推向網路之外,並使其成為一個完整的開發環境。
《ActionScript 3.0 食譜》不專注於理論,而是集中於 ActionScript 的實際應用,提供超過 300 個解決方案,幫助您解決各種常見的編碼難題。您將找到以下食譜,教您如何:
- 檢測用戶的 Flash Player 版本或其操作系統
- 建立自定義類別
- 格式化日期和貨幣類型
- 處理字串
- 建立用戶介面元件
- 處理音頻和視頻
- 使用 Flash Remoting 和網路服務進行遠程過程調用
- 載入、發送和搜尋 XML 數據
- 以及更多...
每個代碼食譜都呈現問題、解決方案,以及如何以其他方式使用它或根據您的需求進行個性化的討論,並解釋為什麼它有效。您可以快速找到最符合您情況的食譜,並獲得解決方案,而無需閱讀整本書以了解底層代碼。解決方案從小問題的簡短食譜進展到更複雜的腳本,針對棘手的謎題,討論提供了更深入的分析,以解決未來類似問題,並提供可能的設計選擇和影響。您甚至會學到如何將模組化的 ActionScript 片段連接在一起,以創建穩固的 Flex 2 和 Flash 應用解決方案。
當您不確定 ActionScript 3.0 如何運作或如何處理特定的編程難題時,您可以簡單地翻閱書籍,找到相關的食譜,快速找到您所尋找的解決方案。
**目錄**
**前言**
**1. ActionScript 基礎**
1.1 創建 ActionScript 專案
1.2 自定義應用程式的屬性
1.3 ActionScript 代碼的放置位置
1.4 如何追蹤訊息
1.5 處理事件
1.6 響應滑鼠和鍵盤事件
1.7 使用數學運算子
1.8 檢查相等或比較值
1.9 條件執行動作
1.10 執行複雜的條件測試
1.11 重複執行操作多次
1.12 隨時間重複任務
1.13 創建可重用的代碼
1.14 一般化方法以增強可重用性
1.15 退出方法
1.16 獲取方法的結果
1.17 處理錯誤
**2. 自定義類別**
2.1 創建自定義類別
2.2 確定保存類別的位置
2.3 創建作為方法的屬性
2.4 創建靜態方法和屬性
2.5 創建子類別
2.6 實現超類方法的子類版本
2.7 創建常數
2.8 派發事件
**3. 執行環境**
3.1 檢測播放器版本
3.2 檢測操作系統
3.3 檢查播放器類型
3.4 檢查系統語言
3.5 檢測顯示設置
3.6 縮放影片
3.7 改變對齊方式
3.8 隱藏 Flash Player 的選單項目
3.9 檢測設備的音頻能力
3.10 檢測設備的視頻能力
3.11 提示用戶更改播放器設置
3.12 處理系統安全
**4. 數字和數學**
4.1 以不同進制表示數字
4.2 在不同數字系統之間轉換
4.3 四捨五入數字
4.4 插入前導或尾隨零或空格
4.5 格式化數字以顯示而不使用遮罩
4.6 格式化貨幣金額
4.7 生成隨機數字
4.8 模擬擲硬幣
4.9 模擬骰子
4.10 模擬撲克牌
4.11 生成唯一數字
4.12 轉換角度測量
4.13 計算兩點之間的距離
4.14 確定圓上的點
4.15 在測量單位之間轉換
**5. 陣列**
5.1 在陣列的開始或結尾添加元素
5.2 遍歷陣列
5.3 在陣列中搜尋匹配的元素
5.4 移除元素
5.5 在陣列中間插入元素
5.6 將字串轉換為陣列
5.7 將陣列轉換為字串
5.8 創建陣列的獨立副本
5.9 儲存複雜或多維數據
5.10 排序或反轉陣列
5.11 實現自定義排序
5.12 隨機化陣列的元素
5.13 獲取最小或最大元素
5.14 比較陣列
5.15 創建關聯陣列
5.16 讀取關聯陣列的元素
**6. 顯示列表**
6.1 將項目添加到顯示列表
6.2 從顯示列表中移除項目
6.3 向前和向後移動物件
6.4 創建自定義視覺類別
6.5 創建簡單按鈕
6.6 在執行時載入外部圖像
6.7 載入並與外部影片互動
6.8 創建滑鼠互動
6.9 使用滑鼠拖放物件
**7. 繪圖和遮罩**
7.1 設定線條樣式
7.2 設定漸層線條樣式
7.3 繪製直線
7.4 繪製曲線
7.5 繪製弧形
7.6 繪製矩形
7.7 繪製圓形
7.8 繪製橢圓
7.9 繪製三角形
7.10 繪製正多邊形
7.11 繪製星形
7.12 用實色或半透明顏色填充形狀
7.13 用漸層填充形狀
7.14 用位圖填充形狀
7.15 編寫遮罩
**8. 位圖**
8.1 創建 BitmapData 物件
8.2 將位圖添加到顯示列表
8.3 將顯示物件繪製到位圖
8.4 將外部圖像載入到位圖
8.5 操作像素
8.6 創建矩形填充
8.7 創建泛洪填充
8.8 複製像素
8.9 複製通道
8.10 創建噪音
8.11 創建 Perlin 噪音
8.12 使用閾值
8.13 對位圖應用濾鏡
8.14 在兩個位圖之間溶解
8.15 滾動位圖
**9. 文字**
9.1 在文字欄位周圍創建輪廓
9.2 為文字欄位創建背景
9.3 創建用戶輸入欄位
9.4 創建密碼輸入欄位
9.5 過濾文字輸入
9.6 設定欄位的最大長度
9.7 顯示文字
9.8 顯示 HTML 格式的文字
9.9 縮減空白
9.10 調整文字欄位大小以適應內容
9.11 程式化滾動文字
9.12 響應滾動事件
9.13 格式化文字
9.14 格式化用戶輸入的文字
9.15 格式化現有文字的一部分
9.16 設定文字欄位的字型
9.17 嵌入字型
9.18 創建可旋轉的文字
9.19 顯示 Unicode 文字
9.20 將焦點分配給文字欄位
9.21 使用 ActionScript 選擇文字
9.22 設定文字欄位的插入點
9.23 響應選擇或取消選擇文字時的事件