Foundation ActionScript 3.0 with Flash CS3 and Flex

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

If you already know AS3 and know how to combine it with Flex and are looking for more advanced examples then do not get this book - get ActionScript 3.0 Cookbook. This book only shows you the basic things and the starting point of most of the examples in the book is either CS3 and Flex - AS3 is used like a helper method.

Author(s): Sean McSharry, Todd Yard, Steve Webster
Edition: 1
Publisher: friends of ED
Year: 2007

Language: English
Pages: 587

Foundation ActionScript 3.0 with Flash CS3 and Flex......Page 1
CONTENTS AT A GLANCE......Page 7
CONTENTS......Page 9
ABOUT THE AUTHORS......Page 19
ABOUT THE TECHNICAL REVIEWER......Page 20
ABOUT THE COVER IMAGE DESIGNER......Page 21
GETTING STARTED WITH ACTIONSCRIPT 3.0......Page 24
Flash CS3 and Flex 2......Page 25
The development process......Page 27
Organizing your files......Page 30
Placing code on the timeline......Page 31
Importing code from an external file......Page 33
Specifying a document class......Page 34
Linking library assets to external classes......Page 35
Creating the Flash file......Page 38
Creating the Ball class......Page 40
Adding more balls......Page 42
ActionScript in action......Page 43
Summary......Page 44
ACTIONSCRIPT 3.0 FUNDAMENTALS......Page 46
Statements and expressions......Page 47
Introducing variables......Page 48
Assigning a value to a variable......Page 49
Retrieving the value of a variable......Page 50
Naming your variables......Page 52
Understanding data types......Page 53
Constants......Page 56
Arithmetic operators......Page 57
Specifying precedence......Page 58
Unary operations......Page 59
Introducing arrays......Page 60
Manipulating arrays......Page 62
Introducing the if statement......Page 64
Forming Boolean expressions......Page 65
Booleans in conditionals......Page 67
Using Boolean operators......Page 68
Looping the loop......Page 69
The while loop......Page 70
The do . . . while loop......Page 73
Looping through an array......Page 74
More for loops......Page 75
Introducing functions......Page 76
Returning a value from a function......Page 78
Using function parameters......Page 81
Allowing for variable parameters......Page 82
Passing values and references......Page 83
Function scope......Page 85
Commenting your code......Page 87
Bad vs. good comments......Page 88
Summary......Page 89
OBJECTS AND CLASSES......Page 92
The iPod analogy......Page 93
Creating objects using the new operator......Page 94
Accessing properties and calling methods......Page 95
Copying objects......Page 96
Casting objects to a type......Page 97
The Object object......Page 99
Iterating over objects......Page 101
Creating your first class......Page 103
Choosing suitable names for your classes......Page 104
Adding properties......Page 105
Adding methods......Page 107
Initializing your objects with a constructor method......Page 110
Controlling access to properties and methods......Page 112
Adding getter/setter methods......Page 114
Creating read-only properties with getter methods......Page 117
Static properties and methods......Page 118
Taking advantage of inheritance......Page 119
Overriding methods of the base class......Page 122
Naming your packages......Page 124
Importing a class from a package......Page 125
Resolving naming conflicts among imported classes......Page 126
Summary......Page 127
WORKING WITH THE DISPLAY......Page 130
Introducing the display list......Page 131
Working with display objects......Page 133
Manipulating display objects......Page 137
Managing depth......Page 141
Creating new display objects......Page 147
Specifying blend modes......Page 149
Applying a filter to a display object......Page 151
Applying filters in a specific order......Page 156
Making changes to an existing filter......Page 157
Removing an existing filter......Page 161
Introducing the advanced filters......Page 163
Making a movie full screen......Page 165
Using Library resources......Page 169
Loading an external asset......Page 172
Copying animation from the timeline......Page 175
Looping the animation......Page 180
Understanding the animation XML......Page 181
Summary......Page 182
Why we need a Drawing API......Page 184
Setting up Mr. Smiley......Page 187
Creating straight lines......Page 189
Controlling the line style......Page 191
Drawing curved lines......Page 193
Drawing primitive shapes......Page 194
Creating custom shapes......Page 196
Filling shapes with a solid color......Page 197
Filling shapes with color gradients......Page 200
Simplifying the code......Page 204
Creating gradient line styles......Page 206
Summary......Page 212
USER INTERACTION AND MORE WITH EVENTS......Page 214
Understanding events......Page 215
Listening for an event......Page 216
Removing an event listener......Page 217
Creating a simple drawing application......Page 218
Handling single and double mouse clicks......Page 225
Handling mouse hover states......Page 229
Handling key presses......Page 235
Preventing an event’s default action......Page 244
Capturing and bubbling: the event flow......Page 248
Listening for events in the bubble phase......Page 249
Stopping an event from propagating......Page 250
Summary......Page 251
Video on the modern Web......Page 254
The video experience......Page 255
Where ActionScript comes in......Page 256
Encoding your video......Page 257
Capturing your video......Page 258
Using the Flash Video Encoder......Page 260
Delivering your video......Page 264
Using ActionScript to play videos......Page 267
Managing connections with the NetConnection class......Page 269
Loading and controlling video with the NetStream class......Page 270
Creating video objects with the Video class......Page 274
Creating camera objects with the Camera class......Page 275
Handling video events......Page 278
Building a video player......Page 285
Setting up the project......Page 286
Controlling the video player......Page 290
Controlling the video on the stage......Page 296
Summary......Page 310
USING AUDIO......Page 314
Using iTunes......Page 315
Using ActionScript to play sound......Page 317
Controlling sound channels with the SoundChannel class......Page 318
Controlling volume and panning with the SoundTransform class......Page 319
Controlling sounds globally with the SoundMixer class......Page 320
Using a microphone with the Microphone class......Page 321
Understanding the basics of a sound player application......Page 322
Building a sound player......Page 333
Setting up the project......Page 334
Adding display items......Page 339
Controlling the audio as it plays......Page 344
Controlling the sound volume and panning......Page 354
Creating the custom event class......Page 363
Summary......Page 364
WORKING WITH COMPONENTS......Page 366
Just what are components?......Page 367
Adjusting parameters......Page 368
Benefits of working with components......Page 372
UI components......Page 373
Video components......Page 375
Going behind the scenes......Page 376
Finding the files......Page 377
Scripting interaction......Page 382
Adding the components......Page 383
Adding the ActionScript......Page 385
Styling components......Page 390
Skinning using the timeline......Page 394
Skinning using classes......Page 397
Creating the widget......Page 401
Writing the component code......Page 403
Turning the symbol into a component......Page 409
Testing the component......Page 410
Using third-party components......Page 411
Summary......Page 412
REGULAR EXPRESSIONS......Page 414
Why we need regular expressions......Page 415
The anatomy of a regular expression pattern......Page 417
Using anchors to restrict the position of matches......Page 419
Providing alternatives using alternation......Page 420
Using character classes and character ranges......Page 421
Matching a number of occurrences using quantifiers......Page 422
Grouping patterns......Page 426
Accessing matched strings with backreferences......Page 427
Understanding the e-mail regular expression pattern......Page 430
Changing regular expression behavior with modifiers......Page 431
Using the global modifier......Page 432
Using the multiline modifier......Page 433
Using the extended modifier......Page 434
Useful regular expressions......Page 435
Summary......Page 436
USING XML......Page 440
XML document components......Page 441
Loading an XML file......Page 443
Reading elements in an XML tree......Page 445
Reading an XML element’s attributes......Page 446
Searching XML......Page 447
Searching for an attribute or element at any level......Page 448
Reading text nodes......Page 450
Adding elements to an XML object......Page 451
Summary......Page 454
CASE STUDY: CREATING A DYNAMIC IMAGE VIEWER......Page 456
An overview of the image viewer......Page 457
Laying out the interface......Page 458
Creating the document class......Page 464
Loading image data......Page 469
Loading the XML......Page 471
Parsing the data......Page 472
Accessing the data......Page 473
Displaying images......Page 475
Handling image selection......Page 477
Adding graphic enhancements......Page 479
Improving the thumbnail layout......Page 480
Adding drop shadows......Page 482
Creating an animated transition......Page 484
Summary......Page 488
GETTING STARTED WITH FLEX 2......Page 490
Meet the (Flex) family......Page 491
MXML......Page 492
Flex Data Services......Page 493
Installing the Flex 2 SDK......Page 494
Building your first Flex 2 application......Page 497
Understanding the Flex Builder 2 interface......Page 501
Building your first Flex Builder 2 application......Page 502
Summary......Page 509
FLEX BY EXAMPLE......Page 512
Gathering the requirements......Page 513
Creating the functional specification......Page 514
Designing the UI......Page 515
Setting up the project......Page 517
Creating the basic UI......Page 519
Installing the XML syndication library......Page 522
Creating the Subscription class......Page 526
Creating the subscriptions list......Page 538
Creating the articles data grid......Page 541
Populating the Article panel......Page 544
Allowing users to subscribe to a feed......Page 545
Saving the subscriptions list between sessions......Page 556
Refreshing the subscriptions list......Page 559
Finishing the Articles panel......Page 562
Finishing the Article panel......Page 567
Improving the feed reader......Page 569
Summary......Page 570
INDEX......Page 572