Home > Store

Flash and XML: A Developer's Guide

Register your product to gain access to bonus material or receive a coupon.

Flash and XML: A Developer's Guide

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2002
  • Dimensions: 7-3/8" x 9-1/8"
  • Pages: 368
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-72920-2
  • ISBN-13: 978-0-201-72920-7

Instead of just "gee-whiz" animation or cool user interfaces, Flash pros need to build truly useful sites that are viable for the long-term. That means interfacing Flash with dynamic content, backend databases, server-based applications, and even with other live users. The key to all these is XML. Now, there's a book that shows you exactly how to build enterprise Flash applications that integrate XML -- and leverage its full power. Flash and XML is structured in 19 progressive lessons. In each lesson, the authors teach a key principle of Flash enterprise integration by first explaining it, and then demonstrating it with working code. The book begins with an introduction to Flash and ActionScript that's ideal for working developers, and also serves as a useful refresher for Flash professionals. Next, the authors introduce XML, review the role of HTTP in Web development, and start writing PHP-based server code for accessing back-end data. Next, they show how to extend Flash and server-side systems to a third-tier, connecting with back-end databases via SQL. Every chapter's code samples build on what's come before, constructing a robust application that encompasses client-side Flash code, server-side XML, back-end remote database access, and even emulated "peer-to-peer" connections. For both Flash professionals (with or without XML experience) and software engineers involved in Web development (with or without Flash experience).

Downloads

Source Code

Click below for Source Code related to this title:
Source Code

Extras

Author's Site

Click below for Web Resources related to this title:
Author's Web Site

Sample Content

Online Sample Chapter

XML Structure

Downloadable Sample Chapter

Click below for Sample Chapter related to this title:
jacobsonch5.pdf

Table of Contents



Preface.

Why this book, who should read it.



Acknowledgments.


1. Flash Basics.

Starting out: Buttons, graphics, text, sound, script.

The Background of Flash.

Practical Flash.

Event-Driven Graphics.

Building a Button.

Constructing a Round.

Making Keyframes.

Constructing the Responses.

Finishing Features.

Conclusion--and Beyond.



2. FlashActionScript: Objects and Events.

Core concepts: Object orientation, event handlers, dynamic text.

Object Orientation Concepts.

Object-Oriented Theory vs. ActionScript Reality.

Flash Objects.

Programmable Button.

Data Encapsulation.

Conclusion.



3. More ActionScript: Data-Driven Interfaces.

Practical work: Thin client, smart graphic elements, exposing data structure.

Data-Driven Decisions.

Data-Driven Everything.

Isolating the Data.

Dynamic Creation of Graphics.

Multiple Questions.

Conclusion.



4. XML Fundamentals.

Big picture: Inspiration, evolution, esthetic, promise.

XML Background.

How XML Works.

Designing the Data.

Conclusion.



5. XML Structure.

Definitions: Elements, names, tags, attributes, content, markup, etc.

Element.

Name.

Start Tag.

End Tag.

Attributes.

Text (Character Data).

Entity References.

Comments.

Processor Instructions.

Conclusion.



6. XML Validation: DTD.

Declaration: Entities, parameters, notations, namespaces.

Purpose of DTD.

Valid XML and Well-Formed XML.

DTD Declarations.

Entities.

Namespace.

Conclusion.



7. HTTP Connection.

Transaction: Request/response, GET, POST, load, variable scope.

Characteristics of HTTP.

Structure of HTTP.

Loading Data from a File.

Making a Self-Loading High Score Display.

Object-Oriented Implementation.

Data File.

Flash Download Security.

Conclusion.



8. XML Connection.

Download: XML files, ActionScript parser, debugger, DOM.

Downloading XML.

XML.load.

Debugging Flash.

Event-Driven Functionality.

Conclusion.



9. Recursive Approach.

Recursion: See Chapter 9.

Event-Driven Code.

Recursive Design.

Recursion.

Recursion in Practice.

Graphic XML Browser.

Interactive Node Viewer.

Conclusion.



10. XML Server.

Two tier: Server-side options, PHP, HTTP header variables.

XML Online.

Dedicated XML Server.

Middle-Tier Solutions.

PHP Basics.

PHP and XML.

XML-Driven Flash Client.

Conclusion.



11. Database Fundamentals.

DBMS 101: Purpose, technology options, relational, rows, columns, keys, joins.

Background.

Advantages of a DBMS.

Advantages of SQL.

Keys.

Conclusion.



12. SQL Syntax.

Practical DB: Building tables, data types, designing queries, getting records.

Varieties of SQL.

Prompt

Tables.

Guidelines for Building a Table.

Types of Data.

Adding Data to Tables.

Reading Records from the Table.

Conclusion.



13. Serving from SQL.

Middle tier: PHP and MySQL, MySQL/functions, results tables.

Connecting to a Database.

Interaction with a Database.

Parsing Commands.

Fetching a Row.

Trial-and-Error Approach.

Scalable Alternative.

Conclusion.



14. XML Upload.

Upload: ActionScript and PHP, HTTP, XML as HTML, XML in browser.

Flash Client.

Uploading to PHP.

Conclusion.



15. Two-Way XML.

Roundtrip: Object exchange, PHP parsing, expat, event-based parser, packet sniffing.

Event-Driven Parsing.

Building the PHP Parser.

Conclusion.



16. Cookies.

Persistence: ActionScript parsing, DOM-based parser, setting cookies, reading cookies.

ActionScript XML Objects.

Stateless Persistence.

Conclusion.



17. Three Tiers.

Three tier: Database, application, client; a flexible system.

Database.

Flexible Middle Tier.

Client Tier.

Conclusion.



18. Flash to the World.

Proxies: Domain perimeter, security, escape, RSS, newsfeeds, content browsing.

Domain Perimeter.

PHP Proxy.

Client.

RSS File.

RSS Browser.

Conclusion.



19. XML Sockets.

Realtime: Socket programming, ports, streaming XML, single-user communications.

Advanced Socket Programming.

XMLSocket.

Simple Socket System.

Simple Socket Server.

Conclusion.



20. Multiplexed XML Sockets.

Multisockets: Scalable, stream servers, multi-user environments, live peer Connections.

Chat.

Client with History.

Multiclient Server.

Beyond PHP.

Conclusion.

End Note.

Upload: ActionScript and PHP, HTTP, XML as HTML, XML in browser.



Appendix A: Microsoft Compatibility.

MS: XML in ASP, MSXML, PHP on IIS

ASP Code with Flash.

IIS and PHP.



Appendix B: Scalable Vector Graphics (SVG).

SVG: Flash without Flash, beyond the swf file



Appendix C: Tools and Sources.

Debuggers, editors, web sites, books, newsgroups, conferences.

Network Tool.

Servers.

XML Tools.

PHP Tools.

MySQL Tools.

Flash.



Index. 0201729202T10222001

Preface

Flash can make fabulous introductions to fancy web sites. High-grade wow factor fills the opening screens. Colors are delicious, typefaces are trendy, and movement is exquisite. Rave music is looping and attitude is everywhere. Each intro is a unique work of art. But they all have one thing in common.

Each has a button that says SKIP INTRO.

Rarely is gratuitous glitz so clearly labeled. When budgets tighten, webmasters will not skip shopping cart, or skip catalog. But they may skip intro.

What's Up?

The web is outgrowing its eye-candy phase, and so must Flash. A web site must be pretty to be viable, but it must be highly functional as well.

Flash pros can't get by on gee-whiz animation or cool interfaces. They'd better prepare to do some of the heavy lifting on the working web. Flash screens must interface with dynamic content, with back-end databases, with server-based applications, and even with other live users.

XML provides a path.

Don't Stop!

Once you connect your Flash code to the outside world, your scope is unbounded. And so is the list of things to learn.

In this book we learn a lot. We begin with Flash and XML. We study networking protocols and PHP server scripting. We learn sockets and SQL and a few fancy XML dialects. We go on to achieve competence in many other related technologies and put them together to build working web systems.

Who Are You?

If you are creative and technical, this book is for you. Maybe you have a design background. You learn whatever technology you need to realize your vision. This book offers you skills that open fresh new worlds. Let's hope your imagination can keep up.

Maybe you have computer science training. You're happy with simple gray buttons. Your art is an elegant code design. You are ready to put Flash to work with all the web technologies you already know.

This book was written by authors who approach Flash from both angles. We want it to speak to both engineers and artists, and we struggled (often with each other) to support both perspectives.

Why?

We wrote this book because it wasn't there when we needed it.

Typographic Conventions

We have adhered to several conventions in this book.

Case Conventions
lowerAndUpperCase is used to name variables and functions in ActionScript
UpperAndLowerCase labels frames and names symbols, objects and constructors.
ALL_UPPER_CASE is used in manifest constants, SQL keywords, PHP globals.
Separated_by_underscores is typically used for PHP names.
Typesetting Conventions
italics indicate names we gave variables, functions, elements, instances, and so on.
codefont shows language keywords and expressions.
codefont is also used to set off the text output of any program.
boldface introduces the first use of an important term.
SMALL CAPS are used for pull-down menu options. Slashes show hierarchy.
"quotes" are reserved for string literals.

These rules are breached occasionally in the book. Sometimes this is for historic reasons, sometimes due to ambiguity and sometimes because it just didn't look right.

Dov and Jesse Jacobson
Berkeley Lake, Georgia
dov@bigfun.net
jesse.jacobson@dartmouth.edu
FlashandXML.com



0201729202P10222001

Index

: (colon), conditional operator values, 44
, (comma), combination operators, 86
( ) (parentheses), combination operators, 86
* (asterisk)
occurrence operators, 86
password fields, creating, 205
| (bar), combination operators, 86
+ (plus sign), occurrence operators, 86
? (question mark), occurrence operators, 86
<!ATTLIST> declaration, 85-86
<!ELEMENT> declaration, 85-86
<? ?> tags (processor instructions), 80

A

absolute URLs, 100
abstraction, markup languages and, 56
access permissions, probing, 107
actions (buttons)
adding to, 9
changing, 12
ActionScript, 2
buttons, adding actions to, 9
decision making capability and, 35-38
encapsulation, 19
event-driven XML parsing, 222-223
loading third party XML, limitations, 271-272
Movie Explorer, 102
node viewer, 137-138
object depth levels, problems with, 47
object instantiation, 24
panels, modes, 9
variables, 13-14
XML comments, 78-79
XMLSocket methods, 298-300
addresses, IP, 276, 295
addressing, targets, 31
ALIAS statement, 184
alignment
buttons, 10-11
enabling HTML checkbox (Text Options), side effects, 39
alternate keys, 165
angle brackets (), XML tags, 71
anonymous username, 231
Answer button (trivia quiz game)
creating, 8
decision making functionality, 36
Answer object (trivia quiz game)
components, 41
XML-driven Flash client, 156-159
XML format, 151-152
AnswerOption objects (trivia quiz game), dynamic creation, 45-49
Answers table (trivia quiz game), MySQL, 173-174
application-level server options, 145-147
application/xml content type, 213
arguments, loadVariables function, 99-100
arrays
associative, 119
childNodes, 115
indexing, 119
nodeTypeName, 129
nodeTypes, mapping to human readable, 129
PHP, 153
question (trivia quiz game), 49-52
scanning, 120
splice( ) method, 49
variables, indexing into arrays, 50
XML element attributes, 73
artifact nodes, 135
ASP (Active Server Pages)
application-level option (servers), 146
compatibility with Flash, 325-328
assignment, variables, 33
associative arrays, 119, 207
XML element attributes, 73
asterisk (*)
occurrence operators, 86
password fields, creating, 205
attachMovie method, 45
attributes
<!ATTLIST> tag, 87-88
node viewer, 137
score (trivia quiz game), 120
start tag syntax, 71
authentication, HTTP, 96
authorization, 96
AUTO_INCREMENT parameters, 164
Avg( ) function, 197

B

back-end tier (servers), 145
bandwidth, XML limitations, 143
bar (|), combination operators, 86
BIGINT data type, 178
binary objects, data types, 179
binding, 276
blank nodes, 133
character filters, 135
node filters, 135-136
BLOB data type, 179
boolean properties, loaded, 113
Border/Bg option, 25
browsers
graphic, 136-138
publish documents, 56
RSS, 283-290
XML, design issues, 62-63
XML tags, stripping, 209-210
buffer control, server-side sockets, 305
button events, 4
button states, compared to button events, 4
buttons
actions, changing, 12
aligning, 10-11
creating, 5-6
decision making functionality, 35
dynamic text fields, 24
encapsulation, adding text, 30
graphic elements, adding, 5-6
instances
creating, 8
naming, 31
options, 25
sounds, adding, 6
spawning dynamically, 45
special text effects, 27-28
states, adding color to, 6
static text, disadvantages, 29
submit (login interface), 206-207
text, adding, 9
variables, disadvantages when adding text, 29

C

callback functions
onLoad, 122
sockets, creating, 301-304
case sensitivity
HTML compared to XML, 81
XML names, 69
CDATA attribute (<!ATTLIST> tag), 87
CelAnimator, 1
<channel> element, 283
ChannelPick MovieClip, 283-285
ChannelView object (RSS browsers), 285-290
CHAR data type, 178
character data (CDATA), 129
character data event (expat parser), 221
character entities, 89
character filters, blank nodes, 135
characters, XML entity references, 76-78
chat applications, 312-313
clients, displaying message histories onscreen, 313-314
childNodes array, 115
chosenAnswer variable (trivia quiz game), 48
classes, 18
classes of DTD entities, 89-91
cleanup, server-side sockets, 306
client-side
cookies and, 245-246
socket programming, 276-280
client tier (servers), 144-145
PHP script for, 265-269
clients
creating for proxies, 280-283
flexible, 35
message histories, displaying onscreen, 313-314
players, validating, 203-207
thin, 35
XML-driven Flash client, 156-159
CLOSE( ) method, 299
code. See also programming
event-driven, 127-128
colons (:), conditional operator values, 44
color, assigning to button states, 6
columns, renaming (MySQL tables), 175
combination operators, <!ELEMENT> tag, 86
comma (,), combination operators, 86
commands
database interaction (PHP), 191-192
database parsing (PHP), 192
databases, listing all, 255
delete, 180-181
fetching fields, 255-256
garbage collection, 194
MySQL_connect, 190
MySQL_pconnect, 190-191
server (PHP), 191
setcookie, 249
update, 180
comment variable (trivia quiz game), associating with answers, 39
comments, XML documents, 78-79
compatibility, Flash and web services, 2
concatenation operator, 149
conditional operators, values, 44
conditional sections (DTDs), 91
conditional testing, recursion and, 130
connect( ) method, 298
constraint parameter, 164
constructors, 20
multiple signatures, lack of, 42-43
parameters, undefined type, 43
XML, 211-212
constructs, 23
content and presentation layers (trivia quiz game), separating, 41-44
content information, HTTP, 97
content rules, <!ELEMENT> tag, 85-86
content types, HTTP and XML, 212-214
contentType property, authorization login, 230-234
cookies, 96, 242
client-side and, 245-246
coding, overview, 244
persistent cookies, 243
privacy concerns, 243
server-side and, 246-249
XML, coding, 244-245
coordinate system (MovieClip), 138
Count( ) function, 197
CPU usage, controlling on multiclient servers, 319
CULT XML socket server, 332
current elements, PHP arrays, 153

D

data-driven decisions, 35-38
data islands, 210-211
data structures, as documents, 60
data types, 23. See also types
binary objects, 179
ENUM, 179
floating-point numbers, 178
integers, 177-178
SET, 179
strings, 178
temporal, 179
database design, three-tiered application design, 254
databases, 163
connecting to (PHP), 189-191
DBMS, advantages of, 162-163
fetching information, 254-256
interaction commands (PHP), 191-192
joins, 165-169
keys, 164-165
listing all, 255
parsing commands (PHP), 192
questions, storing in external file, 161
rows, fetching, 192-194
scalability, indexes and, 162
XML servers and, 144
DATE data type, 179
DATETIME data type, 179
DBMS (Database Management System), 145
advantages, 162-163
SQL, advantages of, 163-164
debugger, 114-116
XML, 119
debugging Flash, 114-122
DECIMAL data type, 178
declarations
<!ATTLIST>, 85-86
<!ELEMENT>, 85-86
DTD, 85-88
DTD entities, 89
Element root node, 115
global variables (PHP), 208
variables, 13-14
default event (expat parser), 222
delete command, 180-181
MySQL tables, 180-181
depth levels, setting, 46-47
describe keyword, 175
<description> element, 283
design issues
industry standards, 64
PHP middle tier database interaction program, 257-261
recursive design, 128-130
XML, browsers, 62-63
destroying objects, 47
Director, 1
display
connection errors, suppressing, 191
fonts, 114
display code, function calls, 129
DNS (domain name servers), 276
document entities, 88
Document Object Mode (DOM), 111
Document Type Definition. See DTD
documents
data structures, 60
HTML, 56-59
parsers, 62
publishing, 56-57
SGML (Standard Generalized Markup Language), 55-56
XML, 59-62
comments, 78-79
entity references, 76-78
text (character data), 74-76
XML notations, 90-91
XML processor instructions, 79-81
DOM-based XML parsing, 219-221
DOM (Document Object Mode), 111
domain names, 295-296
domain perimeter, 271-272
DOUBLE data type, 178
downloading
reassuring users with continued activity during, 100
security, 106-107
XML, 111-112
draggable node hierarchies, 139-140
drop shadow, 28
DTD (Document Type Definition), 83
competing technologies, 84
conditional sections, 91
debugging with, 118-119
declarations, 85-88
entities, 88-91
namespaces, 91-92
notations, 90-91
PHP generated XML files, 152-153
purpose, 83-84
dynamic creation of graphics, 45-49
dynamic IP addresses, 295
Dynamic Text, 14
dynamic text, 121
dynamic text fields, 24, 39

E

each( ) function (PHP), 153
each( ) keyword (PHP), associative arrays, 207
echo statements, length limits (PHP), 150
ECMA-262 (web scripting standard), 2
EditML, 332
element nodes
tags and, 116
trace statement, 117
elements
attributes, 73-74
names, 69-70
rules for, 68-69
tags, 68
XML (eXtensible Markup Language), 67-69
XML structure, 61
empty elements (XML), syntax, 68
empty nodes, 135
encapsulation, 19
advantages, 30
end element event (expat parser), 221
end tag, 72-73
entities
classes, 89-91
DTD, 88-91
ENTITIES attribute (<!ATTLIST> tag), 87
ENTITY attribute (<!ATTLIST> tag), 87
entity references, XML documents, 76-78
enum data types, 179
enumerated lists, <!ATTLIST> tag, 88
ephemeral port assignments, 297
errors
constraint parameters, 164
displaying, getText( ) function, 239-240
server connections, 191
stack overflow, 131-132
Unix codes, server-side sockets, 304-305
eval( ) operator, 118
event-driven code, 127-128
event-driven functionality, 122-124
event-driven XML parsing, 219-225
event handlers, 4-5, 127-128
onConnect, 299
events
button events, 4
event handlers, 4-5
expat parser, 221-222
frame events, 3
mouse events, 4
execution context, 122-123
expat (XML parser), 219, 221-222
Expert mode (ActionScript panel), 9
extension, 19-20
external entity event (expat parser), 221-222
external references, XML, 223-224

F

factorial functions, 130
feature creep, 121
fetch_field command, properties, 266-256
fetching rows (PHP), 192-194
field objects, PHP client tier script, 267-269
fields
buttons, dynamic text, 24
dynamic text, 39
password input, 203-206
files
highscore.txt, 112
highscore_winner.xml, 124
highscore.xml, 111-112
loading data from, 99-100
RSS, 283
XML data storage, advantages, 143
filters, blank nodes, 133-136
#FIXED attribute (<!ATTLIST> tag), 88
flags, Element root node, 115
Flags function, 256
Flash
background, 1-2
compatibility with ASP (Active Server Pages), 325-328
debugging in, 114-122
download security, 106-107
DTD, debugging with, 118-119
event-driven XML parsing, 223-224
event handlers, 4-5
frame events, 3
implementation of object-oriented programming, 20-22
mouse events, 4
new code, debugging, 117-118
players, validating, 203-207
resources, 333-335
trace statements, 116-117
web services, compatibility, 2
XML debugger, 119
XML-driven client, 156-159
flexible clients, 35
FLOAT data type, 178
floating-point numbers, data types, 178
fonts, 114
subsets, advantages of using, 25-26
for statement, array scanning, 120
foreign keys, 165
MySQL, 174
foreign languages, PHP script and, 155
formatting
markup languages, 55
PHP script, 154
fps (frames per second), 3
fragmentation (memory), destroying objects and, 48
frame events, 3
frames. See keyframes
frames per second (fps), 3
FROM statements, 181-182
full-duplex bidirectional connections, 294
function calls, display code, 128-129
functions
callback, onLoad, 122
callback (sockets), 301-304
constructors (objects), 20
data, uploading specific, 209-210
each( ), 153
extracting content from XML string, 273-274
factorial, 130
load failures, handling, 237-238
loadVariables, 99-100, 118
MySQL, querying databases, 197
recursive, 131
sendAndLoadRemote( ), 280-281
shownode, 132
stack, 131-132
string.split( ), 135
submit( ), 206-207
trace( ), 132
FutureSplash, 1

G

garbage collection, 194-195
GET (HTTP upstream transfers), 98-99
files, loading data from, 99-100
getText( ) function, displaying errors, 239-240
global variables, declaring (PHP), 208
Goldfarb, Dr. Charles, 55-56
graphic elements, buttons, adding to, 5-6
graphic XML browser, 136-138
graphics
dynamic creation, 45-49
SVG (Scalable Vector Graphics) standard, 329-330
GROUP BY statement, 183

H

handlers, PHP parser, 225-230
hashes, 119, 207
HAVING statement, 183
header information, HTTP, 97-98
headers, HTTP, cookies and, 248
hierarchies
nodes (draggable), 139-140
XML elements, 67-69
highscore MovieClip (trivia quiz game)
adding local score functionality, 108-109
adding to game, 108
creating, 101-102
data file, 104-105
object-oriented techniques, 103-104
probing access permissions with, 107
upgrading, 123-124
highscore.txt (trivia quiz game), 112
highscore_winner.xml file (trivia quiz game), 124
highscore.xml file (trivia quiz game), 111-112
hsml object (trivia quiz game), 123-124
HTML (Hypertext markup Language), 56-59
compared to XML, 81
headers, compared to HTTP headers, 98
HTML option (Text Options)
enabling, side effects of, 39
special text effects, 25
HTTP channel, clearing, 305
HTTP (Hypertext Transfer Protocol)
characteristics of, 95-97
content types, 212-214
end of request methods, 278
files, loading data from, 99-100
headers, cookies and, 248
port assignment, 276
structure, 97-98
upstream transfer, 98-99
$HTTP_SERVER_VARS variable, 153

I

ID attribute (<!ATTLIST> tag), 87
IDREF attribute (<!ATTLIST> tag), 87
ignoreUnit property, 133
ignoreWhite property, node filters, 136
IIS (Internet Information Server), PHP support, 328
#IMPLIED attribute (<!ATTLIST> tag), 88
indentation strings, 133
indexes
associative arrays, 207
fetching data and, 254
scalability and (databases), 162
indexing, arrays, 119
industry standards, design issues, 64
inheritance, 19
creating, 21-22
Init frame (MovieClips), 237
initializing
objects, multiple signatures and, 42-43
variables, this keyword, 20
inner joins, 167
input fields, passwords, 203-206
instances of objects, 4
buttons, naming, 31
instantiating objects from Library panel, 45
instantiation
buttons, 8
constructors, 20
objects, 18, 24
INT data type, 178
INTEGER data type, 178
integers, data types, 177-178
interactive node viewer, 139-141
interface, username/password, 203-206
internal general entities, 89-90
IP addresses, 276, 295
<item> element, 283

J

joins, 165-169
creating (MySQL), 185-186
JSP (Java Server Pages), application-level option (servers), 146

K

keyframes
creating, 8-11
organizing, 40
keys, arrays, indexing, 119
keywords
describe, 175
each( ) (associative arrays), 207
list( ), 153
list( ) (associative arrays), 207
new, 20
this, 20

L

lastChild object, 115-116
layers
Code, creating, 8
organizing, 40
Sound, creating, 6
leaf nodes, 116
left outer joins, 167-168
Len function, 256
library, instantiating objects, 45
<link> element, 283
list( ) keyword (PHP), 153
associative arrays, 207
listening socket, 307
load failures, handling, 237-238
loaded (boolean property), 113
loadVariables function, 99-100, 118
logic, data-driven decisions, 35-38
logins
players, validating, 203-207
submit button, creating, 206-207
LONGBLOB data type, 179
LONGTEXT data type, 178
Loop frame (MovieClips), 237
loops
arrays, 49
recursive functions, 131
tree-walking, 132
Lose state (trivia quiz game), 11-12

M

markup languages
HTML, 56-59
publishing and, 56-57
SGML (Standard Generalized Markup Language), 55
XML, 59-62
Max( ) function, 197
MEDIUMBLOB data type, 179
MEDIUMINT data type, 178
MEDIUMTEXT data type, 178
memory
garbage collection, 194-195
objects, destroying, 47
stack, 131-132
messaging socket, 308-309
methods, 18-19
attachMovie, 45
predefined, 23
removeMovieClip, 48
splice( ), 49
toString, 114
XML.load, 112-114
middle tier (servers), 145
application-level options, 145-147
PHP script for, 257-261
PHP script for, explanation of, 261-265
Min( ) function, 197
mouse events, 4
Movie Clip symbols, creating, 8
Movie Explorer, 102
MovieClip objects, 23
attachMovie method, 46
ChannelPick, 283-285
coordinate system, 138
frames, dividing into, 237
instantiation, 24
memory, removing from, 48
namespaces, 31
presentation functionality, 41-44
self-loading, creating, 101-102
multiple signatures, constructors and, 42-43
multiplexed servers, 311
chat applications, 312-313
clients, displaying message histories onscreen, 313-314
multiclient servers, programming, 314-319
programming options, 319-312
MySQL, 163, 171
Answers table (trivia quiz game), 173-174
foreign keys, 174
joins, creating, 185-186
logging in, 171-172
MySQLEditor, 333
query resultants, 192
Questions table (trivia quiz game), 173-174
tables
adding data, 179-181
altering, 175
creating, 172-174
reading records, 181-186
MySQL_connect command, 190
MySQL_pconnect command, 190-191

N

Name function, 256
names
node viewer, 137
XML elements, 69-70
namespaces, 30
DTDs, 91-92
naming, button instances, 31
natural joins, 167
nesting
HTML compared to XML, 81
nodes, 140
new keyword, 20
NEW SYMBOL function, buttons, creating, 5
news feeds, RSS files, 283
NMTOKEN attribute (<!ATTLIST> tag), 88
NMTOKENS attribute (<!ATTLIST> tag), 88
node filters, 135
node viewer, 136-138
ActionScript, 137-138
interactive, 139-141
opening/closing branches, 140-141
nodes
artifact nodes, 135
blank, 133
draggable hierarchies, 139-140
empty, 135
leaf, 116
nesting, 140
relationships, 138
text, 136
text in XML documents, 75
XML elements, 67
nodeTypeName array, 129
nodeTypes array, mapping to human readable, 129
Normal mode (ActionScript panel), 9
notation declaration event (expat parser), 222
notations, XML documents, 90-91
NULL values, 164
numbers
floating-point data types, 178
integer data types, 177-178
numeric data type, 178

O

Object Actions, 4-5
buttons, adding to, 9
object-oriented programming
classes, 18
encapsulation, 19
extension, 19-20
Flash implementation of, 20-22
inheritance, 19
instances, 18
methods, 18-19
objects, 17-18
properties, 18
objects
aligning, 10-11
Answer (trivia quiz game), components, 41
AnswerOption (trivia quiz game), dynamic creation, 45-49
array, splice( ) method, 49
ChannelView (RSS browsers), 285-290
classes, 18
creating, constructors, 20
data, adding, 32-33
data types, 23
defining, 23
depth level, setting, 46-47
destroying, 47
encapsulation, 19
extension, 19-20
inheritance, 19
creating, 21-22
initialization, multiple constructors, 42-43
instances, 4, 18
instantiation, 18, 24
Library panel, 45
lastChild, 115-116
methods, 18-19
MovieClips, 23
presentation functionality, 41
nesting nodes, 140
object-oriented programming, 17-18
parameters, undefined type, 43
predefined, 22
properties, 18
prototypes, 21-22
question and answer, XML format, 151-152
question (trivia quiz game), 38-41
round, adding presentation data to, 41
scalar variables, 114
smart decision making, 36
symbols, 23-24
system constructs, 23
targets, 31
trivia quiz game, 22
occurrence operators
* (asterisk), 86
<!ELEMENT> tag, 86
+ (plus sign), 86
? (question mark), 86
onClose( ) method, 299
onConnect event handler, 299
onLoad callback function, 122
recursion and, 132
onLoad handler, 158-159
onload handler, 237-238
onXML function, 300
operators
<!ELEMENT> tag content rules, 85-86
concatenation, 149
conditional, values, 44
eval( ), 118
ORDER BY statement, 183-184
outer joins, 167-168
output, PHP, 147-148
output filters, blank nodes, 133-135

P

packet sniffers, 233-234
Iris, 331-332
parameter entities, 91
parameters
database table (trivia quiz game), 164
depth levels, setting, 46-47
passing, 277
servers, connecting to, 190
setcookie command, 249
undefined type, 43
parentheses ( () ), combination operators, 86
parsers, 62
PHP, creating, 225-234
XML comments, 78
parsing
commands (PHP), 192
XML, event-driven, 219-225
passing parameters, 277
passwords, 96
authentication, contentType property, 230-234
echoing, preventing, 203-206
Perl, application-level option (servers), 146
permissions, probing, 107
persistent connections, servers, 190-191
persistent cookies, 243
PHP
application-level option (servers), 146-147
associative arrays, 207
database interaction commands, 191-192
database parsing commands, 192
databases, connecting to, 189-191
each( ) function, 153
foreign languages and, 155
formatting script, 154
garbage collection, 194-195
$HTTP_SERVER_VARS variable, 153
IIS support for, 328
list( ) keyword, 153
middle tier client design, 265-269
middle tier design, 257-261
output, 147-148
parser, creating, 225-234
persistent server connections, 190-191
PHP Coder, 333
pointers, 153
proxies, creating, 272-280
questions, selecting, 195-199
server commands, 191
server-side, cookies and, 246-249
string operations, 149-150
variables, 148-149
XML files, creating, 150-156
XML string, uploading, 207-208
platform compatibility, design issues, 62-63
players, validating, 203-207
plus sign (+), occurrence operators, 86
pointers
PHP, 153
question (trivia quiz game), advancing, 51
points variable (trivia quiz game), refreshing, 52
polling, 103
port numbers, 296-297
ephemeral port assignments, 297
privileged processes, 297
user processes, 297
ports, 276
POST (HTTP upstream transfers), 98-99
XML string, uploading, 207-208
predefined entities, XML, 88-89
predefined methods, 23
predefined objects, 22
predefined properties, 24
preloaders, Internet downloads, 100
presentation and content layers (trivia quiz game), separating, 41-44
primary keys, 164-165
privacy concerns, cookies, 243
privileged processes, 297
processing instruction event (expat parser), 221
processor instructions, XML documents, 79-81
programming
client-side sockets, 276-280
coding cookies, 244
guidelines, 7
markup languages, 55
multiclient servers, 314-319
PHP proxies, 273-276
polling, 103
server-side sockets, 304-309
projectors (standalone Flash programs), 106
properties, 18
contentType (authorization login), 230-234
ignoreUnit, 133
ignoreWhite, 136
loaded (boolean), 113
predefined, 23
prototypes, objects, 21-22
proxies, PHP, creating, 272-280
<proxy-request> element, 281
<proxy-target> element, 281
proxy transparency, 280
publishing, markup languages and, 56-57

Q

queries
compound, 254
resultants, 192
question arrays (trivia quiz game), 49-52
question mark (?), occurrence operators, 86
Question object (trivia quiz game), XML-driven Flash client, 156-159
question object (trivia quiz game), 38-41
question objects, XML format, 151-152
question pointer (trivia quiz game), advancing, 51
Questions table (trivia quiz game)
joins, 165-169
MySQL, 173-174
questions (trivia quiz game)
selecting from database, 195-199
selecting from database, alternative method, 199-201

R

RDBMS (Relational Database Management System), 163
REAL data type, 178
records, reading (MySQL tables), 181-186
recursion
indentation strings, 133
overview, 130
practical use of, 132
recursive design, 128-130
recursive functions, 131
stack overflow, 131-132
relational databases, operation, 169
relationships
MovieClip coordinate system, 138
node viewer, 137
nodes, 138
relative URLs, 100
removeMovieClip method, 48
#REQUIRED attribute (<!ATTLIST> tag), 88
right outer joins, 167-168
root node, debugger, 115
rounds (trivia quiz game)
creating, 6-8
presentation data, adding, 41
rows
counting returned, 193
fetching, 192-194
RSS browsers, 283-290
RSS files, 283
rtf (rich text formatting), 56
rules
end tags, 72-73
processor instructions, 80-81
start tag, 71
text (character data), 75-76
XML comments, 79
XML element attributes, 74
XML element names, 69-70
XML elements, 68-69
XML entity references, 77-78

S

sandbox (download security), 106
scalability, indexes and (databases), 162
scalar variables, assigning objects to, 114
scanning arrays, 120
Schema (Microsoft), 84
score attribute (trivia quiz game), 120
score variable (trivia quiz game), setting, 38
scoring, local score functionality, adding to trivia quiz game, 108-109
scoring capability (trivia quiz game), 13-15
scripting
ECMA-262 standard, 2
formatting in PHP, 154
secure sockets, 96-97
security
authentication, 96
authorization, 96
cookies, concerns about, 243
downloading, 106-107
loading third party XML, 271-272
secure sockets, 96-97
XML limitations, 143-144
SELECT statement, 181
Selectable option, 25
self joins, 167
send( ) function, uploading specific data, 209-210
Send( ) method, 299
sendAndLoadRemote( ) function, 280-281
server commands, PHP, 191
server-side
cookies and, 246-249
sockets, 294
accepting connections, 307-308
sockets, programming, 304-309
XML processing, 214
servers
back-end tier, 145
client tiers, 144-145
connecting to (PHP), 190
connection errors, 191
creating, three tier solutions, 144-147
CULT XML socket server, 332
middle tier, 145
multiplexed, 311
persistent connections, 190-191
XML, advantages, 144
SET data types, 179
setcookie command, parameters, 249
SGML (Standard Generalized Markup Language), 55-56
shownode function, 132
showtime( ) function, upgrading, 237-238
signatures, constructors and, 42-43
sleep( ) function, 318-319
SMALLINT data type, 178
Smart Sketch, 1
sockets
callback functions, creating, 301-304
client-side programming, 276-280
domain names, 295-296
IP addresses, 295
overview, 276, 294
server-side, 294
sounds, adding to buttons, 6
special text effects, 25
drop shadow, 28
leveraging past work, 27-28
splice( ) method, 49
SQL
advantages, 163-164
compared to XML, 144
SQL (Structured Query Language), types of, 171
stack
functions, 131-132
loops, 131
stack overflow, 131-132
Standard Generalized Markup Language (SGML), 55-56
start element event (expat parser), 221
Start keyframe (trivia quiz game), 8
start tag, 70-71
statelessness, HTTP, 95-96
statements
FROM, 181-182
ALIAS, 184
echo (length limits), 150
GROUP BY, 183
HAVING, 183
ORDER BY, 183-184
SELECT, 181
trace, 116-117
WHERE, 182-183
states
buttons, assigning color to, 6
thinking, 36-38
wait, 36-38
static IP addresses, 295
static text, buttons, 29
stop( ) command, 8
string operations, PHP, 149-150
strings
associative array indexes, 207
data types, 178
indentation, 133
XML, functions for extracting content, 273-274
string.split( ) function, 135
structure, XML (eXtensible Markup Language), 61
subdomains, 271-272
submit( ) function, 206-207, 240
submit button, PHP script, 265-266
Sum( ) function, 197
SVG (Scalable Vector Graphics) standard, 329-330
symbols, 23-24
<!ELEMENT> tag content rules, 85-86
button, creating, 5
Movie Clip, creating, 8
syntax
end tags, 72
MySQL
creating tables, 172
logging in, 171-172
start tags, 71
text (character data), 75
XML, 67-68
comments, 79
element attributes, 73
element names, 69-70
entity references, 77

T

Table function, 256
tables
describe keyword, 175
HTML, 58-59
joins, 165-169
MySQL
adding data, 179-181
altering, 175
creating in, 172-174
guidelines for creating, 176-177
reading records, 181-186
tables (database), trivia quiz game, 164
tags
element nodes, 116
end, 72-73
processor instructions, 80
start, 70-71
<XML>, 210-211
XML elements, 68
targets, 31
Tcl, 320-321
temporal data types, 179
testing
movies, 13
tools, packet sniffers, 233
text
buttons, adding to, 9, 24, 29-30
CDATA, 129
special effects, 25
drop shadow, 28
leveraging past work, 27-28
XML documents, 74-76
TEXT data type, 178
text nodes, 136
Text Options (HTML option), special text effects, 25
Text tool, 9
text variable, values, assigning, 26
text variable (trivia quiz game), 38-41
text/xml content type, 213
thin clients, 35
thinking state, 36-38
third parties, XML, loading from, 271-272
this keyword, 20
this.highscore, 112
three-tiered application design
compound queries, 254
database design, 254
throbbers, Internet downloads, 100
TIME data type, 179
time limits (server-side sockets, 306-307
TIMEOUT parameters, 277
TIMESTAMP data type, 179
TINYBLOB data type, 179
TINYINT data type, 178
TINYTEXT data type, 178
<title> element, 283
tools
Iris (packet sniffer), 331-332
Text, 9
toString method, 114
trace( ) function, 132
trace statements, 116-117
tree parsers, 219
tree-walking, 132
trivia quiz game
AnswerOption objects, dynamic creation, 45-49
buttons, adding to keyframes, 8
chosenAnswer variable, 48
comment variable, associating answers with, 39
content and presentation components, separating, 41-44
data loading capability, adding, 99-100
database elements, 164
decision making functionality, 36
design, 2-3
highscore feature, adding, 108
highscore object data file, 104-105
highscore self-loading display, 101-102
layers, organizing, 40
Lose state, 11-12
objects, 22
points variable, refreshing, 52
question arrays, 49-52
question object, creating, 38-41
question pointer, advancing, 51
questions, storing in external file, 161
Questions and Answers tables (MySQL), 173-174
Questions table, joins, 165-169
rounds, creating, 6-8
score attribute, 120
score variable, setting, 38
scoring capability, adding, 13-15
selecting questions from database, 195-199
selecting questions from database, alternative method, 199-210
Start keyframe, 8
text variable, 38-41
whichquestion variable, 50
Win state, 13
XML-driven Flash client, 156-159
Type function, 256
types. See also data types
<!ATTLIST> tag attributes, 87-88

U

undefined type parameters, 43
Unicode, XML element names, 69
UNIQUE parameter, 164
Unix
error codes, server-side sockets, 304-305
MySQL log in, 171-172
unparsed entities, 90-91
unparsed entity event (expat parser), 222
update command, MySQL tables, 180
upstream HTTP transfer, 98-99
urlencoding, 111
URLs
absolute/relative identifiers, 100
domain names, 295-296
domain perimeter security, 271
HTTP and XML content types, 212-214
user processes, 297
username/password interface, 203-206
users
design issues concerning, 63-64

V

valid XML, 84-85
compared to well-formed, 62
validation
new players, 203-207
XML, 61
values
conditional operators, 44
database table (trivia quiz game), 164
node viewer, 137
VARCHAR data type, 178
variables
arrays, indexing into, 50
assignment, 33
buttons, disadvantages when adding text, 29
chosenAnswer (trivia quiz game), 48
comment (trivia quiz game), associating answers with, 39
decision making and, 35-36
declaring, 13-14
global, declaring, 208
$HTTP_SERVER_VARS, 153
initializing, this keyword, 20
PHP, 148-149
points (trivia quiz game), refreshing, 52
POST (HTTP transfers), 99
scalar, assigning objects to, 114
score (trivia quiz game), setting, 38
text, assigning values, 26-27
text (trivia quiz game), 38-41
whichquestion (trivia quiz game), 50
writing to, 33
vector drawing, advantages, 1
vocabularies, XML (eXtensible Markup Language), 61

W

wait state, 36-38
web scripting, ECMA-262 standard, 2
well-formed XML, 84
compared to valid, 62
WHERE statements, 182-183
whichquestion variable (trivia quiz game), 50
whitespace, 118
indentation, 133
Win state (trivia quiz game), 13
World Wide Web, HTML and, 57

X

XHTML, 81
XML debugger, 119
XML (eXtensible Markup Language)
advantages/disadvantages, 143-144
background, 55-60
browsers, stripping tags, 209-210
case sensitivity, 69
comments, 78-79
compared to HTML, 81
constructors, 211-212
content types, 212-214
cookies, coding, 244-245
creating with PHP, 150-156
data islands, 210-211
design issues, browsers, 62-63
documents, text (character data), 74-76
downloading, 111-112
DTD, 83
element names, 69-70
elements, 67-69
end tags, 72-73
entity references, 76-78
external references, 223-224
Flash nodes, 67
language, 61
nesting nodes, 140
notations, 90-91
overview, 59-60
POST, uploading to PHP, 207-208
predefined entities, 88-89
principles, 60
processor instructions, 79-81
send( ) function, 209-210
server-side processing, 214
start tag, 70-71
syntax, 67-68
tags, 68
third party, loading from, 271-272
tools, 332-333
Unicode support, 69
validation, 84-85
vocabularies, 61
well-formed compared to valid, 62
XML graphic browser, 136-138
XML methods, calling other methods, 238
XML Notepad (Microsoft), 332-333
XML object, 22
XML parsers, expat, 219, 221-222
XML servers, advantages of, 144
XML Spy, 332
<XML> tag, 210-211
xmlAccept( ) function, 239
xmlDeny( ) function, 239
XML.load method, 112-114
XMLSocket, ActionScript methods, 298-300
xmltrace, event-driven code, 127-128

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020