playbackData method – scale9grid propertyrectangles creating, 206–208 Rectangle class.. See Rectangle class union, 208 recursion, defined, 80 Reinhart, Robert, 336 relative local classpa
Trang 1playbackData() method – scale9grid property
rectangles creating, 206–208 Rectangle class See Rectangle class
union, 208 recursion, defined, 80 Reinhart, Robert, 336 relative (local) classpaths, 119 relative positioning technique, 72 relative vs absolute addresses, 21, 45 removeChildAt() method, 86 removeChild() method, 164 removeEventListener() method, 67, 329 reparenting children (display lists), 92–93
replaceSelectedText() method, 266 reset() method (timer events), 67 return keyword, 43
reverse domain naming, 118 _root as absolute address, 74 root nodes, 347
root property, 74, 85 rotating device fonts (TLF), 284 rotation angles, 68, 177
rotation toward objects (animation), 181–183
RoundRectButton classes, 257, 305, 332, 350
#RRGGBBAA color notation, 348 RSL (Runtime Shared Library), 291, 381
S
SafeLoader class, 382, 409 Sally, xvii, xviii, 29, 42, 46–47 SAMPLE_DATA event listener, 329 SampleDataEvent (sound), 325–327 sampling rates
microphone, 323, 327 samplingRate property, 331 _sans, 267, 276
sans-serif fonts, 267 _sans value, 267, 276 SatelliteButton linkage class, 179 saving
bitmap images, 250–252 JPG images, 251–252 saveFile() method, 331 save() method, 252, 332
“Saving Data in Flash Player 9 using PHP” post, 251
scalar quantities, 155 scale9grid property, 216–217
processing instructions in XML, ignoring, 389
ProgressEvent, 366 PROGRESS event, 300 propagation of events, 62–64 properties
class property example, 122 controlling with mouse events, 58–60 CSS, 276
defined, 51, 114 fundamentals of, 53–54
of objects, 44 private, 134 Properties panel, 13, 16, 193 public, 134–135
public properties, 134–135 Publish command (Flash Professional), 3
Publish Settings (File menu), 26 push() method, 37, 393
Q
quadratic Bézier curves, 194 queue, encoder, 340 quotation marks (" "), escaping, 277
R
Radial GradientType constant, 197 radians, defined, 169
Radio class example, 143 random() method (Math class), 165 random seeds, defined, 245 ratios, gradient color, 197 readFloat() method, 318, 326 read-only properties, 134 recording
microphone input at runtime, 329–330
RecordMicrophone class, 328–333 RecordMicrophone_Example class, 327
“Recreating Timeline Tweens with ActionScript" post, 189 Rectangle class, 206–208 containsPoint() method, 208 containsRect() method, 208 inflate() method, 207 intersection() method, 208 intersects() method, 208 offset() method, 207
Pixel Bender filter, 376
setPixel() method, 256
playbackData() method, 330
playback of movie clips, 98–99
playhead movement, 98–100
playing sounds in ActionScript, 302
play() method, 99–100, 109, 143
playSound() method, 330
playVideo() method, 355
plotWaveform() method, 320
plug-ins, TweenLite, 188
plus symbol (+) as concatenation
operator, 29
PNGEncoder class, 257
Point class, 205–206
distance() method, 206
interpolate() method, 206
offset() method, 206
points
calculating changes after
transformations, 211
collision with, 167–168
Point class See Point class
polygons, drawing, 203
polymorphism (OOP)
Car class example, 140–141
defined, 114
inheritance and, 139–140
interfaces and, 142–145
overview, 139
Tires class and document class,
141–142
Truck class example, 141
Vehicle class example, 140
pop() method, 38
positions
finding children by, 88
positionButtons() function, 178
postfix increment/decrement
operators, 28
Preferences, Flash Professional, 119
prefix increment/decrement operators,
28
prependChild() method, 400
prependZeros() method, 254
presets, encoding, 338
priority parameter (listener events), 69
private properties, 134
procedural programming
languages, 9
vs object-oriented programming, 4,
9–11
Trang 2scaleX property – swapChildren() method
spread method (ActionScript), 214 SpreadMethod.PAD constant, 214 SpreadMethod.REFLECT option, 215 SpreadMethod.REPEAT option, 215 sprites
defined, 77 Sprite class, 12 Square class (example), 124 SquarePattern filter, 377 stages
accessing in classes, 130–131 collision with stage boundaries, 168 stage class, 77
stage element (display lists), 74 stage property, 85
StandardFlowComposer, 289–290 startRecording() method, 329 static access control modifier, 133 static data type checking, 6 StaticText class, 77 StatusEvent.Status event, 323 stop() action function, 99 stop() method, 67, 100, 102, 302 stopPlaying() function, 330 stopRecording() method, 329 stopVideo() method, 355 storing/retrieving sound spectrum data, 317
Strict Mode setting (Flash Professional), 26–27 strings, 52
appendText() method, 52 charAt() method, 52 stroke hinting, 216 strokes in Flash, 195 styles
bitmap line, 200 gradient line, 198 line styles, 212 style sheets, building, 276–277 video caption styles, 347–348 subclasses
defined, 114, 122 naming methods of, 139
in OOP example, 9 superclasses
defined, 122 naming methods of, 139 super() method, 136, 141 surfaces (Flash Player, 226 swapChildren() method, 91–92
sizing BitmapData objects in Flash Player, 228
size properties (text), 267 skewing objects with matrices, 210–211 Skinner, Grant, 69
skins, component (video), 341–343 soft-edged masks, 227
solid-color fills, 194–195 Sorenson Media Squeeze, 336 SoundMixer.computeSpectrum(), 317–320
sounds (ActionScript 3.0) amplitude of, 313–316 architecture of, 296–297 Audiotool, 295
buffering, 307–308 changing pan function, 308–310 changing volume of, 308–310 from Flash Professional library, 298–299
ID3Info class, 297 loading external, 299–301 Microphone class, 297 microphone input See microphone
input overview, 7, 296 pausing/resuming, 303 peak meters, adding to sound player, 315
peak meters, creating with masks, 316 playing, 302
reading IDE metadata from MP3s, 311–313
SoundChannel class, 297 Sound class, 297 SoundLoaderContext class, 297, 307 SoundMixer class, 297, 302, 309, 317 sound system, adding to vehicle (example), 145–147 SoundTransform class, 297 spectrum data, 317–318 stopping, 302–303 syntax for player_basic.fla source file, 303–307
Waveform class, 319–321 waveform visualization, adding to sound player, 321–322 Spark codec, 337
spectrum data (sound), 317–318 speed of objects, defined, 155
scaleX property, 54
scaleY property, 54
scaling, 9-slice, 215–217
scenes
basics of, 103
scenes array, 103
scope
automatic management of, 7
defined, 45
of scripts, 91
ScrollPolicy, 289–291
SecurityErrorEvent class, 372–375
security, Flash Player and, 374
selecting text, 265–266
SelectionManager, 289–291
semicolon (;) in ActionScript, 22
"Sending Data from AVM2 to AVM1”
post, 379
sentence builder ActionScript example,
46–48
sequential programming languages, 9
_serif, 267, 276
serif fonts, 267
_serif value, 267, 276
server source (XML send-and-load),
405
setPixel() method, 256
setSelection() method, 265
setter/getter methods, 134–138
setTextFormat(), 268–269
Settings interface (Media Encoder), 339
setTint() method, 254
setupMicrophone() method, 328
Shader class, 377
ShaderFilter property, 377–379
shapes
as display objects, 74–75
drawing with drawPath() method,
202–205
drawing, 195–196
shape class, 76
shearing objects, 209
showChildren() function, 78, 80–81
showMicInfo() function, 324
Shupe, Rich, 21
siblings
defined, 9
nodes (XML), 392
signatures of methods, 143
SimpleButton class, 76, 220–222
sin() method (Math class), 170
Trang 3SWC – tweening
this keyword, 21, 45–46, 91 threaded text, 289
tiling bitmaps, 199 Timed Text, creating captions with, 346–348
timeline control adding frame scripts to movie clips at runtime., 110
basic site or application structure, 108 frame labels, 101–106
currentLabels, 104–106 frame rate, 106–107 frame rate adjustment (example), 97–98
playhead movement, 98–100 timelines
programming, 113
“Recreating Timeline Tweens with ActionScript” post, 189 timeline tweens, rebuilding with ActionScript, 189
Timer class, 66–67 setInterval() method, 66 setTimeout() method, 66 start() method, 66 stop() method, 66 TimerEvent class, 66–67 timer loops, 36
tint property (TweenMax), 188 Tires class (example), 132, 137–138, 141–142
TLF (Text Layout Framework) See Text
Layout Framework (TLF) togglePause() method, 355 to() method, 186
toString() method., 255 toUpperCase() method, 255 tracing
multiple items with commas, 104 trace() function, 22
trace() statements, 43, 393 translate() method, 214 transparency, creating bitmaps with, 229
"Trapping Uncaught Errors” post, 366 Truck class (example), 128, 132, 137, 141 TrueType fonts, 273
try catch blocks, 365 tweening
Adobe Tween class, 184–186
“Recreating Timeline Tweens with ActionScript” post, 189
“Parsing Text Data with Mouse Interaction” post, 266 selecting, 265–266 TextConverter class
See TextConverter class
text editors, 4 TextEvent.LINK event, 278 TextFormat instance, 273 Text Layout Framework See Text
Layout Framework (TLF) text() method (XML), 398 text nodes (XML), 386, 388, 392–396 threaded, 289
Timed Text, 346–348 TLF text, 273 TextConverter class, 289 importToFlow() method, 289 TextField
htmlText property, 275–278 setTextFormat() method, 268–270, 415–418
StyleSheet class, 276–277, 280–282 textColor property, 52
text fields See also text; TextField
creating, 262 creating in Hello World app, 179 dynamic, 263–264
input, 264–265 relative positioning and, 72 setting attributes of, 262–265 TextFieldAutoSize class, 149 TextField class, 76
TextFieldType class, 264 triggering ActionScript from HTML links, 278
Text Layout Framework (TLF) columnar layout, 287–288 defined, 7
distributing SWFs that use TLF, 291 flowComposer property and, 288–290
flowing text across multiple containers, 289–292 loading SWFs with TLF assets, 381 overview, 283–284
rotating device fonts, 284 TextFlow formatting options, 286–288
TextFlow markup tags, 284–285 TLF containers, 289
tlfMarkup property, 287 TLF text, 273
SWC
defined, 119
runtime shared libraries and, 381
SWF files
communicating with loaded, 379–381
defined, 3
distributing SWFs that use TLF, 291
loading, 362–363, 368–369, 381
parent and child, 379–380
“SWF Communication without
Going Through Loader” post,
381
writing multiuse SWF/image loading
class, 364–368
switch statements, 33–34, 60
SWZ
defined, 291
runtime shared libraries and, 291, 381
symbols
“Adding Classes to Pre-Existing
Symbols” post, 82
custom instances, adding to display
lists, 82–84
font symbols, 270–271
symbol base classes, 124
syntax, dot, 38
syntax improvements in ActionScript
3.0, 6
System fonts, 267
T
tab leaders, 80
tab stops (text), 269–270
tags, ID3, 311–312
target event property, 64
\t escape character, 269
Test Movie command (Flash
Professional), 3, 13, 61
text See also text fields
classic text, 273
creating captions with Timed Text,
346–348
displaying in SWF files, 14–16
flowing across multiple containers
(TLF), 289–292
formatting See formatting text
linked, 289
loading, 370–371, 375–376
loading HTML and CSS, 279–283
overview, 261–262
Trang 4tweening (continued) – XML (Extensible Markup Language)
LoaderMax, 383 MPEG-4 format, 337 Pixel Bender Developer, 376 sizing BitmapData objects, 228 source code for examples, 16 Timed Text Markup Language, 346 Timed Text Tags, 347
Using Adobe Media Encoder CS5 resource, 340
while loops, 36–37 white space in XML documents, 388 ignoring See ignoreWhitespace
wildcards (*) in XML, 396 Wildform Flix Pro, 336 writing XML, 399–401
X
XML-based navigation bar directory structure/source files, 406 FLA library symbols, 407
LAS3Main (document class), 408–410
MenuButtonMain class, 415–416 MenuButtonSub class, 416–418 NavigationBarXML class, 410–415 overview, 405
XML document, 407–408 XML (Extensible Markup Language) attributes, using, 396–397
CDATA tags, 389–390 comments in, 389 creating XML objects, 390–391 declaration tags, 389
deleting, 401–402 descendant accessor operator ( ), 395–396
documents, handling in ActionScript 3.0, 6
element nodes in, 392–396 entities in XML specification, 390 finding elements by content, 397–398 finding elements by relationship, 398 loading external XML documents, 402–403
overview, 385–386
“Parsing XML Using Familial Relationships” post, 398 processing instructions in, 389 reading, 392
rules for creating documents in, 387–388
Vehicle class (example), 125–128, 135–137, 139
velocity of objects, 155–156 video
captions See captions, video
components, 340–343 customized video player, creating
See customized video player,
creating encoding See encoding videos
Flash video See Flash video
full-screen video, 343–344 overview, 336–337 video_comp.fla file, 342 video display object class, 76 videos as display objects, 74 Video with Adobe Flash CS4 Professional Studio Techniques (Adobe Press), 336
VisiblePlugin, 411 visualization of waveforms, 321–322 volume, sound (ActionScript), 308–310
W
waveforms (sound) drawing, 318–319 visualization of, 321–322 Waveform class, 319–321 WAVWriter class, 328, 331 weak references, 69 web sites, for downloading Adobe AS3 Core Library, 250 Adobe Pixel Bender Exchange, 376 Audiotool, 295
Aviary suite, 258 bitrate calculator, 338 Captionate software, 346 MAGpie captioning tool, 346 SafeLoader class, 382 ZaaIL package, 251 web sites, for further information ActionScript 3.0 operators, 29 character encoding, 347 Collision Detection Kit, 167 CSS, 274
Flash Blog, 377 Grant Skinner blog, 69 GreenSock Tweening Platform, 189 HTML, 274
HTTP status codes, 366 learning ActionScript, 8
tweening (continued)
timeline tweens, rebuilding with
ActionScript, 189
TweenLite plugins, 411
TweenLite/TweenMax (GreenSock),
186–189
tweens, defined, 157, 183
typed arrays (vectors), 39–40
type(data) casting format, 25
U
uncaughtErrorEvents property (Flash
Player), 366
unconditional alternative code, 31
unloadAndStop() method, 414
updateMouseTransform() function,
310, 315
updateParticleVelocities() function, 173
updateParticleVelocities() method, 174
URLLoader class, 280–281, 371
URLLoaderDataFormat, 371
URLRequest class, 280–281
useCapture parameter (listener events),
69
“Using endFill() with the Drawing API”
post, 195
UTF-8, 347
V
values
returning from functions, 43–44
syntax for setting (properties), 54
variables
basics of, 23–27
Boolean, 24
data types and, 20
int, 24
loading, 371–372, 376
local, 41–42
Number, 24
Object, 24
String, 24
uint, 24
using in XML, 391
vectors
defined, 39–40, 191
drawing with See drawing with
vectors
Vector class, 202
vector quantities, 155
Trang 5ZaaIL library – zero-based arrays Z
ZaaIL library, 318 ZaaIL package, 251 zeno() function, 158 Zeno’s paradox, 157–158 zero-based arrays, 38
send and load server communication,
404–405
structure overview, 386–388
text nodes in, 392–396
using variables in, 391
white space and, 388
writing, 399–401
XMLList class, 394–395