INDEX
Numbers and Symbols3D in Flash, 197-201
3D objects, creating with Drawing API, 165
? (question mark) for greedy quantifiers, 17, 416
/ (slash), in XML tags, 433
* (wildcard symbol) , in searches, 439
Aabstract classes
accessing as Strings, 442
ActionScript 3.0 support for, 110
in XML documents, 433
accessing, properties/methods, 72-73 , 89-90
ActionScript
adding to projects, 8-15
Adobe definition, 2
arithmetic operators, 34-36
arrays. See arrays (ActionScript)
Boolean expressions, 43-44
Booleans in conditional statements, 44-45
brief history of, 2
code commenting, 64-66
constants, 33
development process, 4-7
functions. See functions
if statements, 41-43
importing code from external file, 10-11
in action , 21
linking library assets to external classes, 13-15
logical operators, 46-47
loops. See loops
object-oriented programming and, 4
organizing your files, 7
placing code on timeline, 8-10
playing videos with , 256
scripting interaction in, 374-380
specifying document class, 12-13
statements and expressions, 24-25
string operations, 36
unary operations, 36-37
using to play sound, 305
variables. See variables (ActionScript)
ActionScript 1.0, based on ECMAScript 262, 2
ActionScript 3.0
getting started with, 1-21
objects in events system, 204
support for abstract classes, 110
the rise of, 2-3
using to play sound, 321
website for tutorial, 3
working with filters, 130-143
working with the display, 107-160
ActionScript 3.0 Language and Components Reference, in Flash Help, 361
ActionScript classes, to access, control, and rendervideo, 256
ActionScript Class Warning dialog box, 17
ActionScript source code, modifying, 371-372
addChiidO method, 126
addEventListenerO method, 205, 206
addltemO method, of dataProvider, 377
Adobe
definition of ActionScript, 2
website address, 2, 3
Adobe AIR (Adobe Integrated Runtime), 489
Adobe Exchange,checking for free components,403
AdvancED ActionScript 3.0 Animation, 160, 201
All button, adding a click handler to, 558
alpha parameter, setting in lineStyleO method, 173
alphas parameter, beginGradientFilIO method, 184
alternation (regular expressions), 412
anchors (regular expressions), 411
animated transition, creating, 477-481
569
INDEX
animation
animating other properties, 159-160
copy ing from the timeline, 156
copy ing the code, 158
creating, 157
making things move, 156
Ant , website, 3
application. See feed reader application
arguments, defined, 57
arithmetic operators (ActionScript), 34-36
Array objects, 72
copy ing, 73
arrays, removing elements from, 141-142
arrays (ActionScript)
basics,37-39
looping through, 52-53
manipulating, 40-41
Article panel
adding and wiring up Read more button, 564-565
adding article date to, 564
creating readSelectedArticleO function in, 565
finishing, 563-565
populating, 540-542
articles data grid, creating , 538-540
articlesGrid control, 541
Articles <mx Panel>, adding width and height in, 538-539
Articles panel
changing title attribute of, 539
changing title attribute value of, 539
finishing, 559-563
need for control columns in, 566
as operator, 74
assignComponentReferencesO method, 458
assignHandlersO method, 459
attributes
in XML documents, 434
namespace, 80
audio, using, 301-353
AVM1Movie class, 110
Bbackreferences
in regular expressions (\) , 418-420
using after pattern matching, 420-421
with String.replaceO method ($), 420
570
Ball class
adding more balls, 19-21
creating, 17-19
making ball bounce around , 17-19
Ball symbol, adding to movie , 150-152
base class,overriding methods of, 99-101
beginFillO method, filling shapes with, 180-183
beginGradientFillO method, parameters for, 184-186
[Bindable] metadata tag, adding, 532
[Bindable] metatag, adding to List control, 535
binary operators, 35
BitmapFilter class, subclasses of, 130
BlazeDS, website address, 489
BlendMode class, importing, 129
blendMode property, setting , 128
blend modes, specifying in ActionScript, 128-129
block comments (code) , 65
Boolean data types, 31
Boolean expressions (ActionScript)
basics, 43-44
in conditional statements, 44-45
Boolean variables, 74
bouncing balls
adding more , 19-21
building Flash movie with, 15-21
creating Ball class, 17-19
creating Flash file, 16-17
BoundingBox_mc, 367
bounds (regular expressions), 416-417
break statements , 53, 230
Brown, Charles E., 485
bubble phase, listening for events in, 238-239
buffering, your video , 259
buffer preloader, basic code with, 311-312
Button class,associating skin classes with, 391
Button component, 363
adding to stage, 359
button events, handling for sound player, 339-343
ButtonManager.as class
adding button functionality to , 284-290
adding event listener for, 287
adding functions to, 285-286
completed, 288-290
creating new file in, 283
passing button instance references to, 284
ButtonManager.as file
adding button event handlers, 335-336
adding button functionality, 334-339
adding event listeners, 334-335
adding import classes and variable definitions, 333-334
controlling audio with, 333-343
for sound player, 337-339
buttons
associating with skins, 390-391
disabling, 378-379
handling when to enable, 379-380
ButtonSkins folder, in Component Assets folder, 366
button skin symbols, in Button5kins folder, 366
button states, creating skins for, 389-390
button up state, creating skins for, 388-389
ByteArray.readFloatO method, 319
Ccalling, methods, 72-73
camel case notation (ActionScript), 29
Camera class, 256
creating camera objects with, 262-265
methods, 264-265
public properties, 262-264
camera objects, creating with Camera class, 262-265
Cancel button
wiring up, 546-547
canvasobject, 212
setting line style and adding to stage, 208
caps parameter, setting in line5tyleO method, 173
capture phase
listening for events in, 239-240
cases, 230
case-insensitive modifier (regular expressions), 423
case study, creating a dynamic image viewer, 449-482
casting,
defined,214
objects to types, 74-76
centerPopUpO method, calling PopUpManager's, 545-546
character classes/ranges (regular expressions), 412-413
CheckBox component, 363
additional parameters available, 356
child children syntax, 437
childO method, 465
child nodes (XML), 432
classes
character (regular expressions), 412-413
choosing names for, 81
creating, 80-81
defined,71
INDEX
grouping with packages, 101
importing from packages, 103
naming conflicts among imported, 104
skinning using, 387-391
ClickTest class, creating, 215
cloneO method, overriding, 549-550
codecommenting (Action5cript), 64-66
importing from external file , 10-11
placing on timeline, 8-10
timeline, 104
codecs, for encoding video, 245-246
color, filling shapes with solid, 18D-183
color parameter
setting in line5tyleO method, 172
using in call to beginFillO method, 222
ColorPicker component, 363
colors parameter, beginGradientFillO method, 184
com.adobe.xml.syndication.generic package, importing allclasses from, 529-530
ComboBox component, 363
Commenting code (ActionScript), 64-66
Component Assets folder, 366
Component_avatar symbol, in _private folder, 367
Component Definition dialog box, 400
Component Inspector panel, 356
setting component properties in, 362
components
accessing, 357-358
adding metatags, 399-400
adding to create interface, 374-375
benefits of working with , 362
categories of , 362
creating from scratch, 392
creating the widget , 392
getting and setting dial values, 397-399
scripting interaction, 374-380
setting styles for all, 382-383
setting styles for all instances of, 383
setting styles for a single instance of, 383-384
testing after creating, 401-402
trying out in a movie, 401-402
turning Dial symbol into , 400-401
using third-party, 403
what they are, 356
working with, 355-403
writing code for rotating dial, 395-396
writing event handling code, 394-395
writing the code, 393-400
571
INDEX
Components directory, 369
ComponentShim.fla file , 370
ComponentShim symbol, 367-368
Component Source directory, 370-372
Components panel
accessing components from, 357-358
adding components to , 452
Flex Builder 2, SOl
concatenating strings, 36
Configuration/Component Source/ActionScript 3.0
modifying UI components source code in, 371-372
configureComponentsO method, 474
creating , 461
constants (Action5cript), 33
capitalizing, 30
const keyword , 33
constructor method, initializing objects with, 87-89
constructors
naming, 71
regular expression, 408, 426
contentLoaderlnfo property, adding listener with, 478
continue command (loops), 53
ControlBar container, adding to Articles panel, 560-561
Convert ID3 Tagsdialog box, 304
Convert to Symbol dialog box, 110
filled in for Ball class, 16-17
ConvolutionFilter, 143
Copy Motion as ActionScript 3.0, animating propertieswith, 159-160
copying, objects, 73
countToTenO function, 56
cpHandler function, adding to Videos.as file , 282-283
createGradientBoxO method, building a gradient matrixwith ,188-189
Create Motion Tween option, 157
Create New Symbol dialog box, adding new library assetsin, 13-15
creationComplete attribute, adding to project, 506
crossdomain .xml file, 511
cue point events
handling, 269-272
handling for video player, 282-283
cue points , adding, 270-272
Cue Points pane, Flash Video Encoder, 270
curveToO method, drawing curved lines with, 174-175
custom event, creating, 297
custom shapes, creating, 179-180
572
Ddata
accessing ImageData class data, 466-467
parsing ImageData class data, 464-466
data and logic , designing, 514
data binding, using Subscription instance for, 532-534
DataGridColumn instance, setting labelFunction propertyof,561
DataGrid component, 363
DataGrid control
adding in VDividedBox control, 502-503
creating articles data grid, 538-540
setting properties for, 503
dataProvider property
adding to DataGrid object, 538-539
for List instance, 377
data types, 30-32
decrement operator, 37
default keyword, using in switch statements, 231
deleteName_bn button, 378
deleteName_bn component, changing color of, 383-384
Depew, Issy, website created by, 244
Design vie, working in, 500-504
Dial, rotating, 395-396
Dial class
adding getters and setters to, 397-399
adding min and max value properties to , 397
getting and setting dial values, 397-399
rotating the dial, 395-396
writing code for, 393-394
Dial symbol, turning into a component, 400-401
Directory, defaults for Flash installation, 368
DisplacementMapFilter, 143
Display, working with, 160
display items, adding to sound player, 328-333
display list
introducing, 108-110
removing display objects from, 127
display object, applying filter to, 131-135
DisplayObject class, in MovieClip class hierarchy, 108
display object classes, how they relate to one another, 108
DisplayObject classes, 214
DisplayObjectContainer class, in MovieClip class hierarchy,108
display objects
altering index of, 124-125
applying filter to, 131-135
creating new, 126
discovering depth of, 120-122
in display list, 108
managing depth of, 119-125
manipulating, 114
manipulating depth of, 119, 122-123
removing from display list, 127
swapping depths, 124-125
working with, 110-127
display5tate property, drawbacks of, 145
document class
creating, 456-461
Property inspector with it added , 12
setting , 112
specifying, 12-13
Document Properties dialog box, 451
documentation, commenting for, 66
dotall modifier (regular expressions), 425
dot metacharacter (regular expressions), 413-414
doubleClickEnabled property, setting for mouse clicks,214
double-dot operator, 441
do .. . while loops (Action5cript), SO-51
down casting, 75
drawCircleO method, draw ing pr imitive shapes with , 175
drawEllipseO method
draw ing outline of ellipse with, 195-197
drawing primitive shapes with, 175
Drawing API
creating graphs and sound visualization with, 164-165
creating vector graphics with, 163-201
draw ing crosshair using, 226
introduction of, 165
setting up Mr. Smiley, 166-168
understanding, 166
why it is needed , 163-165
drawing application
creating simple, 207
refreshing the screen, 213
setting up the canvas, 207-209
DrawingApplication class
creating, 207
creating new Sprite display object, 208
drawList5hadowO method, 475-477
drawRectO method, drawing primitive shapes with , 175
drawRoundRectO method, drawing primitive shapes with,175
INDEX
Drop5hadowFilter instance
creat ing, 475-477
creating new, 136
setting angle property, 139-140
drop shadows, adding to ImageViewer class, 475-477
EE4Xstandard (XML), 433
E4Xsyntax, finding nodes with, 465
Eclipse, for editing Mac as x files, 492
Eclipse open development platform, website address for,496
ECMA5cript 262, Action5cript 1.0 based on, 2
editable list, creating interface for, 374-375
EditableList.as file, adding Action5cript to , 375-380
EditableList class
adding Action5cript for, 375-380
adding lines to, 376-377
editableListfla file, creating, 374-375
editName_ti, disabling, 378-379
element value, 433
email patterns (regular expressions), 421-422
emphasized property, 361
empty elements , defined (XML), 433
endFillO method, 183
end-of-string anchors (regular expressions), 411
Essential Guide to Flex3, The, 485, 489
Event class
creating to get the feed , 547-552
event as instance of, 204
EventDispatcher class, 464
event flow, capturing and bubbling, 237
event handler, adding for button click , 147-148
event handler method, 205
event handling
writing code for, 394-395
event listener, 206
event listener methods, naming, 207
event listeners, using one for multiple objects, 214
Event object, checking cancelable property of, 233
event phases, values for, 238
events
listening for, 205-206
stopping from propagating, 240
understanding, 204-214
using with the display list, 214
573
INDEX
execO method (RegExp object), 420
explicit getter/setter methods, 91
expressions, defined (Action5cript), 24
extended modifier (regular expressions), 426
extends keyword , 96
Extensible Markup Language (XML). See XML (ExtensibleMarkup Language)
external asset, loading and manipulating, 153, 155-156
external classes, linking library assetsto, 13-15
external files
importing code from, 10-11
loading from, 153-156
Ffalling through, 230-231
fast-forward and rewind functionality, 314-315
fast-forward end (FFEND) event, 291
fast-forward (FF) event, 291
FeedFactory class, static methods of, 528
feed integration
creating basic, 518-525 , 542
installing XML syndication library, 519-521
testing Subscription class, 525-527
feed reader application
adding ability to organize subscriptions, 566
adding reading list support, 566
creating basic UI, 516-518
creating functional specification for, 511-512
creating UI, 516-518
designing data and logic,S14
designing interaction, 513-514
designing UI, 512-513
gathering requirements, 510-511
improving, 566
limitations imposed by Flash Player, 511
planning, 510-514
setting up project, 514-516
feed reading, features needed for, 512
feeds, features needed for refreshing, 512
feedURL property
creating and modifying constructor, 549
private function for updating, 533
feedURLs array, creating, 554
FFT(fast Fourier transform) algorithm, 316
FFTMode parameter, 50undMixer.compute5pectrumOfunction, 318
574
Files, organizing, 7
file system, finding files in, 368-372
filters
applying in specific order, 136-137
applying to display object, 131-135
assigning to square2's filter property, 136-137
introducing advanced, 143
making changes to existing , 137-141
removing existing, 141-143
working with Action5cript's, 130-143
filters property
for display objects, 130
overwriting with a new array, 138
reassigning filters array to , 140-141
FilterTest class, changing to remove filter from square,142-143
FilterTest classconstructor, creating new Drop5hadowFilterinstance in, 136
Flash, default directories for, 368
Flash 3D, 197-201
Flash Action5cript 3.0 file
creating and naming, 374
Flashcomponent framework, 372
going behind the scenes, 366-368
styling and skinning, 381-391
Flash Components network, website address, 403
Flash C54, components available with standardinstallation, 356
FlashDevelop text editor, 492
flash.display.DisplayObjectContainer, 108
flash.display package, 108
Flash file, creating bouncing.fla, 16-17
flash.filters package, filter classes in, 130
Flashloaded, website address, 403
Flash movie, building with bouncing balls, 15-21
Flash Player
feed reader limitations imposed by, 511
preventing an event's default action in, 233
security sandbox, 511
Flash Player 9, Flex as part of, 487
flash.uLKeyboard class, numLock property, 224
Flash Video Encoder
adding video file to , 249
adjusting encoding settings in, 249-251
Encoder Profiles tab, 249
opening, 249
starting encoding process, 251
using, 248-251
Video tab options, 250-251
fIIcore directory
Action5cript classes found in, 371
in Flex, 516
Flex
by example, 509
planning the application, 510-514
setting up and managing project with IDE,S14
Flex 2
building your first application, 492-496
getting started with, 485
introduction to, 486
meet the family, 486-489
Flex 2 Software Development Kit (SDK), 488
getting started with , 489-492
installing for Linux, 492
installing for Mac as X, 492
installing for Window XPNista, 490-491
website for downloading, 489
Flex BuilderlFlex Builder 2, 26-27, 488
building your first application, 496, 497-499, 506-566
choosing new Flex project type, 497
creating new Flex project, 497-499
getting started with , 496-506
naming and setting directory location of project, 497
understanding the interface, 496
working in Design view, 500-504
working in Source view, 504-506
Flex Data Services, 488
Flex Data Services Express, website address for, 489
Flex framework, 487
build ing application with , 514-516
Flex project
gathering requirements for, 510-511
planning, 510-514
Flex Properties panel
Flex Builder 2, 501
setting DataGrid control properties in, 503
Flex Start Page, 496
FLVfiles
using Flash Video Encoder to get, 248-251
values for video metadata in, 267-268
FLV (Flash video) format, 245-246
FLVPlayback component, 365
FLVPlaybackCaptioning component, 365
focalPointRatio parameter
adjusting location of focal point with, 187-188
beginGradientFillO method, 184
focus property, 225
INDEX
focusRect5kin symbol , in Shared folder, 367
for each loops , 78-79
for in loops, 78
for loops, 53
for loops (Action5cript), 51-52
foundationA53.com website, creating reader for blog on,493-496
Foundation XML and E4X for Flash and Flex (friends ofED),446
Frame rate option, on Profiles tab, 250
Friedl, Jeffrey, 427
functions
creating, 55-56
default values for function parameters, 59
function scope, 63-65
overview, 54-55
parameters, 58-59
passing variables by values and references, 61-63
returning values from, 56-58
variable parameters , 60-61
GgetChildByNameO method, 394
getChildlndexO method, 120
getFeedBy5tringO method, FeedFactory class, 528
getFeedByXMLO method, FeedFactory class, 528
getNameDataO method, adding to ImageData class,466-467
getter methods, creating read-only properties with , 94-95
getter/setter methods, adding, 91-94
getThumbDataO method, adding to ImageData class, 467
getTimeO method, 530
global modifier (regular expressions), 424-425
GlowFilter
changing properties of, 134-135
parameters, 134
using, 131-135
Google Finance, website address, 164
gradient fills, filling shapes with, 183-189
gradient line styles
creating, 191-197
dealing with gradient rat ios, 194-195
giving linear gradient fill , 191-197
setting up properties for gradient, 193-194
graphics.drawRect method, 319
greedy quantifiers, 415-416
grouping patterns (regular expressions), 417-418
575
INDEX
HH.264 codec, formats supported by Flash Player 9, 246
H.264 files, video metadata reported in, 268-269
handler. See event handler
hasOwnPropertyO, 76
Hbox, setting another as sibling, 544
HDividedBox container, adding in UI, 517
headPosition function, creating for Video .as file , 280-281
htmlText attribute, adding to project, 506
htmlText property, setting, 541
HTIPService class
loading feed data with, 527
using with data binding, 488
ID3 event handler, setting up, 321
ID3 events, handling, 319
ID31nfo class
commonly available tags, 319
getting ID3 data with, 309
public properties, 309
supported tags without predefined properties, 319-321
ID3 information, adding using iTunes, 303-304
ID3 metadata tags, getting information out of, 321
ID3 track metadata, displaying for sound player, 332-333
id attribute, 439
adding to project, 506
if statements (ActionScript), 41-43
litem interface, implementing, 530
Image class, 451
image data, loading, 461-463
ImageData class, 451
for loading the XML, 463-464
instantiating to display images, 468-470
parsing data, 464-466
ImageHolder class,451
adding listener to , 480
animating alpha property, 480-481
displaying and loading images with, 479
for loading an image, 477-478
Image instances, creating, 465-466
image label, changing, 473
ImageLoader class, editing to load and display images, 479
imagePadding style property, setting , 474
576
images
changing label for, 473
displaying, 468-470
enabling zooming of, 472
handling selection of, 470-471
improving thumbnail layout , 473-474
scaling, 472
image viewer
adding graphic enhancements, 472-481
laying out the interface, 451-456
overv iew of, 450-451
ImageViewer.as
adding information to, 456-457
creating document class in, 456-461
ImageViewer class
adding drop shadows, 475-477
assigning timeline object references to, 457-458
creating a shape and shadow in, 475-477
creating, 456-461
importing flash.events.Event, 458-459
making TileList tiles bigger in, 473
ImageViewer document class, 451
iMovie HD, capturing video with, 248
implicit getter/setter methods, 91
import statement, adding for MovieClip, 113
importing
classes from packages, 103
naming imported classes, 104
increment operators, 37, 49
indexOfO method, 236
String objects, 72
inheritance, fundamentals, 96-99
initO method, 376
initializing objects, with constructor method, 87--89
Inspectable tag, adding to Dial class, 399-400
instances, Object , 76-78
interaction design, 513-514
InteractiveObject class, in MovieClip class hierarchy, 108
interfaces, in object-oriented languages, 529
interpolationMethod parameter, beginGradientFillOmethod, 184
iPod analogy (object orientation), 70
IrisReader.mxml file
adding ControlBar container to, 544
adding DateFormatter variable to, 559-560
changing initO method of, 552
subdirectories, 515
is operator, 74
iterating over objects , 78
iTunes
converting to MP3 format with, 303
using, 302-304
JJacobs, Sas, 446
joints parameter, setting in lineStyleO method, 174
KKeyboardDrawing.as file, setting up, 225
KeyboardDrawing class, creating, 225
KeyboardEvent class,events instances of, 224
KeyboardEvent.KEY_UPevent, handling, 224-233
keyCode property, KeyboardEvent class, 224
Key frame placement option, on Profiles tab, 251
LLabel component, 363
labelFunction property, setting, 561
Label instance, attaching and positioning, 451
label parameter, for CheckBox component, 356
labelPlacement parameter, for CheckBox component, 356
labelPlacement property, 361
labels, changing for images, 473
labels layer, adding components to, 453
lastChecked property, of 5ubscription object, 530-531
lengthO method, determing number of images with, 465
length property (5tring objects), 72
library assets, linking to external classes, 13-15
library resources, using, 150-152
Library symbols, creat ing instances of, 150-152
line comments (code), 65
lineGradientStyleO method, calling to set up lineargradient, 195
lines
adding vertical to a graphic , 170
controlling style of, 171- 174
creating completely disconnected, 170
draw ing, 168
drawing curved, 174-175
drawing straight , 168-170
INDEX
lineStyleO method, 168
controlling line style with , 171-174
line styles, creating gradient, 191- 197
lineToO method, 168
List component, 363
List control
creating, 535
using custom label function with, 536
list layer, adding component to , 455
List_Skin symbol, editing, 385
List symbol , entering symbol-ed iting mode from, 384
list view, toggling based on radio button selection,460-461
literals
regular expression, 408
string, 26
LiveCycle DS,488-489
services provided by, 489
toadpatan function, creating, 554-555
toadpatau method, adding a call to , 555
Loader class, creating new instance of, 154
LoadExternalTest class, creating, 154
10adO function, executing on URLLoader instance,435-436
loadlmageliataf) method, 469
loadlrnagef) method, Loader instance created by, 478
loading progress bar
creating for sound player, 328-329
implementing for video player, 279
10adO method, 154
of Sound class,307
loadsongr) function
adding event listener to , 332
loading sound file with , 327
local variables, 63
logical negation operator (!), 37
logical operators (Action5cript) , 46-47
loop control variables, 49
loops
breaking out of, 53-54
do .. . while loops, 50-51
for loops, 51-53
looping through arrays, 52-53
overview, 47
while loops, 47-50
577
INDEX
MMain.as file
completed, 287-288
creating, 274-275
creating for sound player, 323-324
for sound player, 336-337
Mastering RegularExpressions (O'Reilly), 427
Math .atan20 method, 396
matrix parameter, beginGradientFillO method, 184
mdHandler function, adding to Videos.as file , 281-282
MediaControlEvent, 286-287
MediaControlEvent.as class, creating, 352
MediaControlEvent.as file, creating, 297
MediaControlEvent class, for sound player, 336
MediaControlEvent.CONTROL_TYPE events
adding handler for to Videos.as file, 290-297
handling in Sounds.as file, 339-341
metacharacters (regular expressions), 410, 413-414
metadata, handling for video player, 281-282
metadata event listener, setting up, 281
metadata events, handling, 267-269
metatags, adding to Dial class, 399-400
methods
adding (iPod example), 84-87
adding getter/setter, 91-94
calling, 72-73
controlling accessto , 89-90
overriding, 99-101
static, 95
Microphone class, 309-310
Microphones, using with Microphone class, 309-310
miterLimit parameter, setting in lineStyleO method, 174
modifiers (regular expressions), 422-426
modulo operators, 35
moov atoms, 269
mouse-click events, example showing how they work,215-217
mouse clicks, handling single and double, 214
MOUSE_DOWN event , 285
MOUSE_EVENT, handling, 394-395
MouseEvent class,204
MouseEvent.DOUBLE_CLlCK event, 214
MouseEvent listeners, adding to CLICKevent , 265
MouseEvent.MOUSE_OVER, 218
MouseEvent.ROLL_OVER, 218-219
mouse events, handling, 265
mouse hover states, handling, 218
mouse move and release events, handling, 395
578
MOUSE_UP event, 285
moveToO method, 170
movie clip
changing opacity of, 117-118
creating and placing on stage, 110-113
setting rotation property for, 118-119
MovieClip class, 108-109
movie clip symbol, converting display object to , 110-113
movies, making full screen, 146-150
MP3 format, using iTunes to convert to, 303
MP3 player, building, 321-352
Mr. Smiley
adding radial fill to face, 186
creating a new Smiley instance, 168
creating document class for, 167-168
setting up, 166-168
setting up subcomponent for, 167-168
Shape class as base class for, 167
simplifying the code for, 189-191
multiline modifier (regular expressions), 425
Multimedia Extensible Markup Language. See MXML(Multimedia Extensible Markup Language)
mx, configuring, 501-504
MXMA blog aggregator, website address, 314
mxmlc command-line compiler, for RSSReaderapplication, 494-495
MXML (Multimedia Extensible Markup Language),487-488
NnameData array instance, creating, 466-467
names_li , editing or removing items from, 377-380
naming
classes, 81
constructors, 71
imported classes, 104
methods, 84
packages, 101-102
variables (ActionScript), 29-30
Navigator panel, new RSSReader project in, 499
nested skins, in ScrollBar symbol , 386
NetConnection class, 256
example using, 257
managing connections with, 256-257
NET_STATUS event , setting up NetStream instance tolisten for, 278-279
NetStatusEvent class,205
NetStream class.256
example using. 258
loading and controlling video with, 257
onStatus events and errors . 266
public properties. 258
NetStream instance. setting up. 278
NetStream onStatus event , 278
NetStream .pauseO function, 291
NetStream .Time information, getting for Video .as file. 281
New Flex Project dialog box, 514
New Flex Project Wizard, 498
new ImageO method, 466
new keyword, 408
creating component instance with , 358
creating new display objects with. 126
node. defined (XML). 432
NumericStepper component. 363
new operator. 38
creating objects with, 71-72
numeric data types. 31-32
oobject-orientation iPod example, 70
Object Oriented Actionscript 3.0 (friends of ED), 105
object-oriented programming (OOP). ActionScript and, 4
objects
casting to types. 74-76
copy ing, 73
creating with new operator, 71-72
in OOP. 4
initializing with constructor method. 87-89
instances of. 76-78
iterating over. 78
Object object. 76-78
'OBRmx, changing layout attribute of, 517
OK button. wiring up, 546-547
onAddNameO method. 377
onCanvasEnterFrameO method. 233
onCanvasKeyUpO listener, 232
onCanvasKeyUpO method, 229
onCanvasMouseDownO method, creating. 209-210
onCanvasMouseMoveO method. creating. 210
onCanvasMouseUpO method, creating, 211-212
onClickDialO handler. 395
onDataLoadedO method, 469-470
onDeleteNameO method, 377-378
one-or-more quantifier, 415
INDEX
onlmageLoadedO method, 478
onlmageSelectedO method. 460, 479
handling image selection with, 470-471
onListViewChangeO method, 461
onMetadata callback handler, viewing metadatainformation with , 267
onNameChangeO, editing list items with, 377-378
onNameSelectedO handler. 378
onOKButtonClickO method, modifying. 550
onRefreshTimeO event handler function, adding, 557
onReleaseDialO method. 395
onRotateDialO method, 395
onServiceResultO event handler
changing to use new functions, 534
expanding . 530
fleshing out. 528-532
onSpectrumO now function. adding to Sounds.as file, 332
onSquareDoubleClickO method
creating. 216
tracing string values in, 217
onSquareRollOverO method
calling drawSquareO method in, 222
creating. 219
onSubscribeDialogSubscribeO method, adding saveDataOmethod call to , 555-556
onTextFieldTextinputO handler. 236
onTextFieldTextinputO method. creating. 235-237
onXMLLoadedO method, 465
onZoomO method. 460, 472
OOP (object-oriented programming). See object-orientedprogramming (OOP)
operators
as operator. 74
is operator. 74
outputArray parameter, SoundMixer,computeSpectrumOfunction, 318
overloaded operators, 36
overriding methods of base class, 99-101
ppackage comJoundationAS3.ch4. adding import
statement to, 148
packages
defined. 80
importing classes from. 103
naming, 101-102
using to group classes, 101
579
INDEX
Panel containers, in UI, 516
panning , controlling, 316
parameters
adjusting, 358
function, 58-59
Parameters panel, 356
getting information about, 361
in Component Assets folder, 366
labeling button in, 360
opening, 359
parent nodes (XML), 432
parsing, ImageData class data, 464-466
patterns (regular expressions)
anatomy of, 409-410
email ,421-422
grouping, 417-418
pauseO command, 291
Pause event handler, for sound player, 336
Pause functionality, 286
PEMDAS,35
Perspective Angle field, 198
Peters, Keith, 160, 201
pixelHinting parameter, setting in lineStyleO method, 173
Play event handler, for sound player, 335-336
Playhead, storing position of, 312
playhead bar
creating for sound player, 329-331
creating for video player, 280-281
popt) method, removing elements from arrays with, 141
PopUpManager.removePopUpO method, 546
postfix increments, 50
prefix increments, 50
PreventDefaultTest.as
creating and saving, 234
creating basic package and class definitions for,234-235
primitive data types, 30-31
primitive shapes, drawing, 175-178
priority parameter, for addEventListenerO method, 206
private properties, 90
Problems panel
checking errors from, 527
for Flex Builder 2 project, 503-504
Program nodes, 439
ProgressBar component, 363
ProgressEvent class,205
project directory, 7
selecting for application, 515
580
projects, adding ActionScript to, 8-15
properties
accessing, 73
adding (iPod example) , 82-83
controlling accessto , 89-90
creating read-only with getter methods, 94-95
static, 95
property variable, 78
PropertyChangeEvent object
adding remaining public properties to, 533
creating, 532-533
propertyChange events, manually dispatching, 532
public namespace attribute, 80
public properties, 90
QQuality option, on Profiles tab, 251
quantifiers (regular expressions), 414-416
RRadioButton component, 363
radios layer, adding components to, 455-456
ranges, character (regular expressions), 412-413
ratios parameter, beginGradientFillO method, 184
readFloatO function, 319
Read more button, adding and wiring up, 564-565
read-only properties, creat ing with getter methods, 94-95
read5electedArticleO function, creating, 565
references, passing variables by, 61-63
refreshAllO function, creating, 556
refresh function, adding, 531-532
refreshSelectedO function, creating, 558
refreshTimer variable, creating, 556-557
RegExp class, regular expressions, 408
RegularExpression PocketReference (O'Reilly), 427
regular expressions
alternation, 412
anchors, 4"
backreferences ($) with 5tring.replaceO method, 420
backreferences (\), 418-420
backreferences, using after pattern matching, 420-421
bounds , 416-417
builiding with variables, 426
case-insensitive modifier, 423
character classes/ranges,412-413
defined, 406
dotall modifier, 425
dot metacharacter, 413-414
dot metacharacter, 414
email patterns, 421-422
examples of common, 427
extended modifier, 426
global modifier, 424-425
greedy quantifiers, 415-416
grouping patterns, 417-418
metacharacters, 410, 413-414
modifiers to change behavior of, 422-423
multiline modifier, 425
one-or-more quantifier, 415
patterns, anatomy of, 409-410
quantifiers, 414-416
reasons for using, 406-408
reference resources, 427-428
RegExp class, 408
Regular Expression Library website, 428
zero-or-more quantifier (*), 415
zero-or-one quantifier (?), 414-415
removeChildAt() method, 127
removeChildO method, 127
removeEventListenerO method, using useCaptureparameter of, 241
removeltemAtO method, 378
renderArticlesGridDateO function, creating, 561-562
renderSubscriptionsListLabelO function, creating in<mx Script> block , 537
renderSubscriptionsListLabel value, setting for labelFunc-tion attribute, S36
reserved word (ActionScript), 29
resumeO function, 291
return keyword , 56-S7
rewind end (RWEND) event, 291
rewind (RW) event, 291
RIA (rich internet application) development, 2-3, 486
RolloverTest class
making colors constants in, 223-224
responding to rollover events with , 219-222
root node
in XML document, 432
reading, 437
rotation property, setting for movie clip, 118-119
RPCs (Remote Procedure Calls), 436
RSS application, proposed layout for, 512
INDEX
RSSReader application
adding root element for MXML document, 494
compiling the application, 494-495
creating src and bin directories for, 493
setting coding attribute for, 494
writing MXML for, 494
RSSReader.mxml file
adding remainder of MXML in, 495-496
open in Source view, 499
runFFO function, 292
runRWO function, 292
RWEND event, 291
RW event , 291
SsaveDataO function, creating, S53
saveDataO method, adding calls to, 555
scaleMode, setting , 145
scaleMode parameter, setting in lineStyleO method, 173
scope, function, 63-65
script blocks, 487
ScrollBar Skins, accessing from List symbol, 38S-386
ScrollPane component, 364
scrollpane layer, adding component to , 453
seekpoints , 269
Selected button, adding click handler to, 558
selected parameter, for CheckBox component, 356
selected property, 361
SE IPY, for editing Mac as x files, 492
_service object, adding event listeners to, 528
setChildlndexO method, 122-123
setComponentStyleO method, setting style for allcomponent instances, 383
setFeedURLO function, 533
setStyleO method, 383-384
setStylesO method
creating, 382
setting all component styles with, 382-383
Shape instance, creating for Mr. Smiley, 165
shapes
creating custom, 179-180
drawing and filling, 175-189
drawing primitive, 17S-178
filling with color gradients, 183-189
filling with solid color, 180-183
Shared folder, in Component Assets folder, 366
581
INDEX
shiftKey property, flash.uLKeyboard class, 224-225
shiftO method, removing elements from arrays with, 141
sibling nodes
creating same name, 444
replacing , 445
signatures, function, 60
SimpleButton class, turning square object into a buttonwith,223
SimplelmageCell.as, creating, 473-474
SimplelmageCell class, 451
Singleton, 272
SkinnedList.as, 390-391
skinning
using classes for, 387-391
using timeline for, 384-387
skins
associating with buttons, 390-391
creating for button up state, 388-389
creating for other button states, 389-390
slash (I), in XML tags, 433
Slider component, 364
slider layer, adding component to, 454
sliceO method (Array objects) , 73
Smiley class, rewritten with the with statement, 190-191
smiley face
drawing face and eyes, 175-177
drawing glasses for, 177-178
drawing mouth of, 179, 180
simplifying the code, 189-191
using fill methods, 180-183
sound
classes associated directly with, 305
controlling volume, 315-316
fastforwarding and rewinding, 314-315
pausing, 312-313
stopping, 313
using ActionScript to play, 305-321
sound.as class
adding declarations to , 331
adding event handler code to , 333
adding event listener to loadsongn function in, 332
instantiating variables, 331
Soundbooth, using, 305
SoundChannel class
controlling sound channels with, 306
public properties, 306
setting position property with, 312-313
SoundChannel.stopO function, stopping sound with, 313
582
Sound class
accessing sound files with, 305
demo , 306
public properties of, 306
Sound.c1oseO method, 313
sound files
converting to MP3 format with iTunes, 303
importing and converting, 302
SoundLoader class, public properties, 307
SoundLoaderContext class, doing security checks with,307
soundManager instance, adding to display list, 327
SoundMixer class, controlling sounds globally with,308-309
SoundMixer.computeSpectrumO function
in ActionScript 3.0, 316
parameters accepted by, 318
sound player
adding display items, 328-333
adding sound spectrum, 331-332
building, 321-352
controlling audio as it plays, 333-343
controlling volume and panning , 343-352
creating loading progress bar, 328-329
creating playhead bar, 329-331
displaying ID3 track metadata, 332-333
handling button events for, 339-343
setting up project, 322-327
sound player application
definitions and commands, 310-311
pausing sound, 312-313
preloading a buffer, 311
understanding basics of, 310-321
Sounds.as class
adding Timer declarations to , 342-343
adding volume and panning settings, 341-342
buffering sound, 327
constructor for, 326-327
creating, 325-327
defining function to play sound file , 327
handling events in, 339-341
import and variable declarations, 325-326
storing volume and pan settings in, 341-342
Sounds.as class instance, adding to display list , 334
Sounds class
creating instances of, 323
declaring and creating Main constructor, 324-325
sound spectrum
adding for sound player, 331-332
displaying, 316-319
SoundTransform class, controlling volume and panningwith, 307-308
sound visualization, creating with Drawing API, 164-165
Source view, working in for project, 504-506
Specification, creating functional for feed reader, 511-512
spectrum timer, adding event listener to, 331
spliceO method, removing elements from arrays with,141-142
spreadMethod parameter, beginGradientFiIIO method,184
Sprite class, 111-112
sprite object, new in Action5cript 3.0, 109
Square symbol
changing width and height of, 115-117
moving on the stage, 114-115
square variable
changing to a private property of object, 220-221
stage, 150
making movies full screen, 146-150
Stage class, 145
Stage.focus property, 225
setting to receive keyboard events, 227
stageHeight property, 145
stage properties, using, 145
5tage5caieMode class, 145
stageWidth property, 145
start-of-string anchors (regular expressions), 411
_startRadians, 396
_startRotation, 396
statements and expressions (ActionScript), 24-25
States panel, Flex Builder 2, 501
static properties/methods, 95
status events, handling, 265-267
status text field, setting up for video player, 278-279
Stop event handler, for sound player, 336
stopPropagationO method, 240
storyboarding, for animation development,S
stretch Factor parameter, 50undMixer.compute5pectrumOfunction, 318
String.indexOfO method vs. regular expressions, 406-408
string literals, 26
String objects, 71
String objects , 72
string operations (ActionScript), 36
5tring.replaceO method ($), using backreferences with,420
INDEX
5trokedCircle.as , 389
5trokedCircleDisabled.as, 389-390
5trokedCircleDown.as, 389
5trokedCircleOver.as, 389
strong tags, 420, 425
5tubblebine, Tony, 427
style blocks, 487
5tyledList.as, setting up for changing styles, 381-382
5tyieManager class
importing into cell renderer, 474
setting styles with, 382
styles
setting for all components, 382-383
setting for single instance of component, 383-384
setting up for changing, 381-382
styling and skinning, 381-391
styling components, 381-384
setting up for changing styles, 381-382
subscribeButton component, adding click event handlerfor, 545
5ubscribeDialog component
laying out, 543-544
wiring up buttons for, 544-547
5ubscribeDialogEvent.as file , adding constructor functionto , 548-552
5ubscribeDialogEvent class, creating, 547-548
5ubscribeDialog.mxml file, binding enabled property ofOK button, 552
subscribeO/unsubscribeO functions, creating, 545
Subscription class
creating, 522-525, 527
loading the data, 527-532
onServiceResultO event handler method, 528-532
testing , 525-527
using for data binding, 532-534
subscription management, features needed for, 512
subscriptions, allowing users to manage, 542
_subscriptions array, adding new Subscription object to ,550-551
subscriptions list
creating, 535-538
manually refreshing, 557-559
refreshing automatically, 556-557
saving between sessions, 553-556
Subscriptions panel, completing, 542-559
_subscriptions variable , initializing, 526
5WF files
development process, 4-7
paths for creating, 3
583
INDEX
switch statement
used by OnCanvasDownO listener , 230-231
vs. if else if statement, 230
switch statements , 214
Symbol class, creating, 13
symbol-editing mode, entering, 384
Tterminator, statement, 24
ternary operators, 35
testing, components after creating, 401-402
TextArea component, 364
adding to VDividedBox control, S04
TextArea control, in Article panel, S40-541
text editor
for editing ActionScript 3.0 and MXML files, 492
for editing Mac OS X files, 492
TextEvent.TEXT_INPUTevent, adding a listener for,23S-237
TextField object, filtering characters entered into, 234
Textlnput component, 364
changing graphics for, 386-387
text nodes, defined (XML), 433
thickness parameter, setting in lineStyleO method,171-172
third-party components, using, 403
thumbnail layout, improving, 473-474
TileList component, 364
tile list layer, adding component to, 455
timeline
creating layers in, 452
placing code on, 8-10
using for skinning , 384-387
timeline.fla file, creating, 8-10
timeline graphics, editing, 386-387
Timer code, adding to Videos.as class file, 291
Timer declarations, adding to Sounds.as file , 342-343
Timer event handler function, code for, 318-319
title attribute
changing value of, 539
changing value of in Article panel, 541
TitleWindow container, setting title property in, 544
togglePauseO function, 291
toStringO method, 76
calling on an XML object, 465
584
traceO function, 26, 76
traceO statement, 112, 437
type parameter, beginGradientFillO method, 184
UUI components, 363-364
UILoader component, 364
UIScrollBar component, 364
UI (user interface)
creating for Flex application, 516-518
designing, 512-513
UI widgets, components as, 356
UML diagram, showing classes and how they interact,S
UML specification, website address, S14
unary operations (ActionScript), 36-37
unary operators, 35
Unified Modeling Language (UML), 5
unsubscribeO method, 553
adding saveDataO method call to, 555-556
URLLoader instance, 436
loading external XML file with, 464
URLRequestclass, 154
for loading sound files, 30S
URLRequest (XML), 436
useCapture parameter, for addEventListenerO method,206
User Interface directory, 370
user interface. See UI (user interface)
user-specified refresh interval, improving feed readerwith,566
useWeakReference parameter, for addEventListenerOmethod,206
Vvalues
assigning to variables (ActionScript), 25-26
default for function parameters, 59
of variables, retrieving (ActionScript) , 26-28
passing variables by, 61-63
returning from functions, 56-58
variable parameters, 60-61
variables
builiding regular expressions with, 426
passing by values and references , 61-63
property, 78
variables (ActionScript)
assigning values to, 25-26
Boolean, 74
Boolean data type , 31
local,63
naming, 29-30
numeric data types, 31-32
overview, 25
primitive data types, 30-31
retrieving values of, 26-28
VDividedBox control
adding DataGrid control to, 502-503
adding Panel containers as children to , 517-518
adding TextArea component to , 504
adding to Flex Builder 2 project, 502
adding to HDividedBox parent, 517
vector graphics, creating with Drawing API, 163-201
video
adding button functionality, 284-290
buffering, 259
capturing, 247-248
controlling on the stage, 283-297
delivering, 252-255
delivery method comparisons, 252-255
encoding, 245-246
experience of, 244
fast-forwarding and rewinding, 260-261
handling events for, 265-272
marketing use of, 244
on the modern Web, 243-245
pausing, 259
playing, 259
playing with ActionScript, 256
security of loading and playing, 255
software for capturing, 247
stopping, 259
where ActionScript comes in, 245
working with, 243-298
Video .as file, getting NetStream.Time information for, 281
Video class, 256
creating video objects with , 261-262
public properties, 261
Video codec option, on Profiles tab, 250
video components, 365-366
video events, handling , 265-272
Video object
adding to display list, 261-262
example for creating, 261
video objects, creating with Video class, 261-262
video player
building, 272-297
class files for, 272
controlling, 278-283
creating the Main.as file, 274-275
creating the playhead bar, 280-281
creating the Videos.as file, 275-277
handling cue points, 282-283
handling metadata, 281-282
implementing loading progress bar, 279
setting up project, 273
setting up status text field, 278-279
Videos.as class
adding timer handler functions to, 291
finishing, 290-297
Videos.as file
adding cpHandler function to, 282-283
assigning references for, 276
calling and playing, 277
creating, 275-277
creating event handler in, 278-279
creating headPosition function for, 280-281
declaring variables for, 275
finished version of, 281 , 292-297
netConnection and netStream classsetup, 276
Videoss.as file, adding mdHandler function to, 281
visitSelectedSiteO function, creating, 563
Visit site button, adding, 562-563
visual objects . See also display objects
managing depth of, 119-125
volume, controlling, 315-316
volume and panning
adding settings to Sounds.as file , 341-342
controlling for sound player, 343-352
Wwebsite addresses
ActionScript 3.0 tutorial, 3
Adobe Exchange, 403
Adobe information, 511
Adobe , 2, 3,488,489
Ant, 3
Ask a Ninja, 244
Brightcove, 244
Crackle, 244
INDEX
585
INDEX
Eclipse open development platform, 496
Ecma International, 433
Eyespot, 244
Flash Components network, 403
F1ashDevelop text editor, 492
Flashloaded, 403
for downloading book files, 7
for Flex Builder trial, 488
GolfSpan, 244
Google Finance, 164
Hulu, 244
"Great Pockets", 244
[urnpcut, 244
mommetv.com, 244
Motionbox, 244
MXMA blog aggregator, 314
Regular Expression Library, 428
Rewer, 244
stickam.com , 244
UML specification, 514
YouTube, 244
while loops (ActionScript), 47-50
widgets. See also components
creating visual, 392
drag-and-drop, 355
wildcard symbol (*), in searches, 439
Windows Movie Maker, capturing video with, 247
with statement, Smiley class rewritten with, 190-191
586
XYZ_xDirection property, 228
XML and E4X, 434
XML document, components of , 432-433
XML elements , 433
reading attributes, 438
searching for, 440-442
XML (Extensible Markup Language)
getting data from remote source, 436
modifying, 443
reading, 436
reading text nodes, 442
searching, 439-442
using, 431
XML file
accessing, 434-436
displaying into application, 461-463
loading and creating image instances, 463-464
loading, 434-436
loading with URLLoader instance, 464
XMLList object, 437
XML object
adding elements to , 443
creating, 434
removing elements and attributes from, 446
XML syndication library, installing, 519-521, 566
XML tree, 432
reading elements in, 437-438
x, y coordinates
position of 0, 0, 170
3Direction property, 227
zero-or-more quantifier (*), 415
zero-or-one quantifier m, 414-415
1-59059-543-2 $39.99 [U5] 1-59059-518-1 $39.99 [U5] 1-59059-542-4 $36.99 [U5] 1-59059-517-3 $39.99 [U5] 1-59059 -65 1-X $44.99 [U5]
$59.99 [U5]
-~···-- IFromAfter Effects .to Flash ,it.
'"i: ; '~
1-59059-3 15-4$59.99 [U5]1-59059-314-6$49.99 [U5]1-59059-558-0
1-59059 -619-6 1-59059-304-9 1-59059-355-3 $24.99 [U5] 1-59059-409-6 $39.99 [U5] 1-59059-748-6 $49.99 [U5]
-- DOM ScriptingActionscript Components Flash Interface Design_ ."C- .-c.....-...--
----
B-- - -
= .:il [) ~~- ?Y;~-" .....-:._ - n1-59059-593-9 $49.99 [U5] 1-59059-555-6 $44.99 [U5] 1-59059-533-5 $34.99 [U5] 1-59059 -638-2 $49.99 [U5] 1-59059-765-6 $34.99 [U5]
1-59059-581-5 $39.99 [U5] 1-59059-614-5 $34.99 [U5] 1-59059-594-7 $39.99 [U5] 1-59059-381-2 $34.99 [U5]
Join the friends of ED forums to find out more about our books, discover useful
technology tips and tricks, or get a helping hand on a challenging project. Designer
to Deslqner" is what it's all about-our community sharing ideas and inspiring each
other. In the friends of ED forums, you'll find a wide range of topics to discuss, so
look around, find a forum, and dive right in!
• Books and InformationChat about friends of ED books, gossip about thecommunity, or even tell us some bad jokes!
• FlashDiscuss design issues, ActionScript, dynamiccontent, and video and sound.
• Web DesignFrom front-end frustrations to back-end blight,share your problems and your knowledge here.
• Site CheckShow off your work or get new ideas.
• Digital ImageryCreate eye candy with Photoshop,Fireworks, Illustrator, and FreeHand.
• ArchivEDBrowse through an archive of old
questions and answers.
Go to the friends of ED forums at www.friendsofed.com/forums.