Add seamless, interactive, user-controlled delivery to your Flash applications. This book builds upon your understanding of basic ActionScript (AS) syntax with the foundational skills that you need to use XML in Flash applications and AS2 or AS3 to migrate your existing applications. Beginning with an introduction to XML, XML parsing methods, and a short introduction to AS2 you learn how to create a universal XML load/onload Class as well as a universal XHTML parser. Then you learn how to use Components using XML as the data source, including the menu, menubar, datagrid and tree component. Finally, a tutorial project-the design and development of a Real Estate Web site that contains an XML search engine-pulls it all together with hands-on experience. All the applications use XML as the data source and are written as class files. Select parts of the Real Estate Web site are redeveloped in AS3 for purposes of illustration. The new XML class is presented and specific code examples demonstrate techniques to apply methods and use properties. Particular attention is paid to the differences between AS2 and AS3 and how to effectively transition from one AS version to the other.The companion CD contains code for all of the properties and methods of the AS2, AS3, and XML class examples. Components for the Real Estate Web site project are also provided. *Build on basic ActionScript syntax skills*Add seamless, interactive, user-controlled delivery
Author(s): Joachim Bernhard Schnier
Publisher: Focal Press
Year: 2007
Language: English
Pages: 335
Front Cover......Page 1
Flash XML Applications......Page 4
Copyright Page......Page 5
Contents......Page 6
Acknowledgements......Page 8
Introduction......Page 10
Section 1 Introduction to XML Applications and ActionScript 2......Page 14
The Structure of an XML Document......Page 16
The DTD......Page 17
XML Nodes......Page 18
The Need for XML......Page 19
RSS Feeds and Web Services......Page 20
XML Has Strict Rules......Page 21
XHTML, a Dream of the W3C School......Page 22
Why Learn ActionScript 2?......Page 23
ActionScript 2 Syntax......Page 24
Constructor......Page 25
Execution of the Hello Class......Page 26
Variables......Page 27
Casting......Page 28
Extending a Class......Page 29
Getter and Setter......Page 31
The XML Class: Properties......Page 33
The XML Class: Events......Page 36
The XML Class: Methods......Page 38
The Object Class......Page 42
The XMLNode Class: Properties......Page 43
The XMLNode Class: Methods......Page 47
A Regular XML Load/onLoad Script......Page 51
Introducing the Delegate Class......Page 52
proxy.php: calling XML from a different server......Page 53
InitiateXml.as: from HTTPstatus over onData to onLoad......Page 54
Loading the XML File......Page 55
Testing the InitiateXml Class......Page 57
Accessing XML Nodes: The Script......Page 59
Accessing Nodes......Page 60
For Loop......Page 61
For In Loop......Page 62
idMap Array......Page 63
Parsing XML with Namespaces......Page 64
Structure of the XHTML File......Page 66
The Decodehtm_simple Class......Page 67
The Main Function "xmlLoad"......Page 68
Parsing the XML File......Page 69
Looping through the XHTML File: The Head Part of the Class......Page 71
The First Loop: Catching the Node......Page 72
The Second Loop: Catching the Node......Page 74
Introduction......Page 76
The Mortgagequote Class: Declaring Variables......Page 77
Function to Check Users' Entry......Page 78
Submit Function......Page 79
The PHP Script: mortgage.php......Page 81
Contact Form......Page 84
Section 2 Components......Page 86
The Menu and MenuBar Components......Page 88
The Menu_tut Class......Page 89
MenuBar Component: Creating a Menu (XML Document)......Page 92
The Menubar_tut Class......Page 93
ActionScript......Page 95
Tutorial: The Multiple-Choice Selection XML File......Page 98
Class SelectCombo......Page 100
Overview: XMLConnector......Page 103
Tutorial: Creating a Real Estate Display withthe XMLConnector......Page 104
Connecting the XML to Components......Page 105
Binding of List Component to the XMLConnector......Page 107
Binding of TextArea Instances to the List Component......Page 108
Creating a Mortgage Calculator with the WebServiceConnector: Connecting to the Web Service......Page 109
Adding Function to the WebServiceConnector......Page 110
Analyzing a Commercial XML......Page 115
Movie Organization......Page 116
The RSS Feed Script: Variables and Classes......Page 117
The Header of the RSS Feed......Page 118
Adding Data to the DataGrid Component......Page 119
Formatting the Cells......Page 121
Adding Functionality......Page 122
JavaScript in Browser......Page 123
Section 3 Creating a Real Estate Web Site......Page 124
The XML Document......Page 126
Creating the Menu......Page 127
The FinalMenu Class......Page 128
Structure of the Search Engine......Page 134
The Design Pattern: Model Viewer Controller......Page 135
Setting Up the Database.fla......Page 136
Interface......Page 137
Writing Classes: DBaseInterface and ArrangeStage......Page 138
Preparing the SelectCombo Class......Page 140
The DataBase Class: Introduction......Page 141
The Function "initLoading"......Page 143
Parsing the XML Document......Page 145
Preparation of the DataBase Class for the Display......Page 150
The DisplaySearch Class......Page 151
The Holder Class......Page 155
The Mask Class......Page 157
XHTML, SWF, and htmParser......Page 159
The Detailsbut Class......Page 161
Calling the Detailsbut Class......Page 163
Changing the DataBase Class......Page 164
The NextModul Class: Planning......Page 165
Additions to Other Classes......Page 167
The NextModul Class: Script......Page 168
Adding a Save Option to the Database.fla......Page 173
Adding Function to the saveBut Button......Page 174
Saving XML Nodes: The SaveNodes Class......Page 175
Adding Display/Clear Buttons......Page 178
Displaying Saved Data: The DisplaySaved Class......Page 179
Adding a Function Call to the Database Class......Page 180
The Home Frame......Page 181
The Non-MySQL Version......Page 184
The ContManagement Class......Page 186
The ContMenu Class: XML File......Page 187
The ContMenu Class: Script......Page 188
The AddNodes Class: Adding and Arranging Objects......Page 191
The AddNodes Class: Creating and Sending the XML Node......Page 195
newxml.php: For Adding Nodes......Page 199
Deleting Nodes: The DeleteNode Class......Page 201
Deleting Nodes: delinfo.php......Page 205
The MySQL Version......Page 207
The ContManagement .fla File......Page 208
The AddNodes Class......Page 209
Getting Data: The DataBase Class......Page 212
Writing php files to add nodes, get data and delete nodes......Page 213
Section 4 ActionScript 3......Page 216
AS3 Overview......Page 218
AS3 Packages: Hello World......Page 219
Hello World: Second Thoughts......Page 221
The Package Deal......Page 222
Public, Private, Internal, Protected......Page 223
Null–Undefined......Page 224
The Timeline......Page 225
Override......Page 227
Object Handling......Page 228
Events......Page 232
Namespaces......Page 235
Full Example Code......Page 239
The XMLDocument Class......Page 241
XMLNode Class......Page 242
XML Class......Page 244
The XMLList Class......Page 269
The LoaderClass Class......Page 270
Testing the LoaderClass Class......Page 273
The Menu Bar: .fla......Page 275
The Menu Bar: XML......Page 276
The Menu Bar: Myparser.as......Page 277
The Menu Bar: MenuButton Class......Page 280
The Menu Bar: LinkButton Class......Page 284
The ComboBox: Overview......Page 285
The ComboBox: ComboMenu Class......Page 286
The ComboBox: LinkButton Class......Page 287
Overview......Page 291
The Search Engine Interface......Page 293
Arranging Objects on the Stage: The Arrange Stage Class......Page 294
The ButText Superclass......Page 298
Extending the ButText Class: Example EventButton Class......Page 301
AlertBox and AlertButton Classes......Page 302
Search Engine: DataBase Class......Page 303
Search Engine: The HouseDisplay Class......Page 307
Improving Performance......Page 310
The NextModul Class......Page 314
Saving Data: The SaveButton Class......Page 319
Saving Data: The SaveNodes Class......Page 322
Saving Data: The DisplaySaved Class......Page 323
Movie Optimization: First Revision......Page 325
Movie Optimization: Second Revision......Page 327
Final: Completing the Real Estate Web Site......Page 328
B......Page 330
C......Page 331
I......Page 332
S......Page 333
X......Page 334