Foundation ActionScript 3.0 with Flash CS3 and Flex (eBook)

eBook Download: PDF
2008 | 1st ed.
450 Seiten
Apress (Verlag)
978-1-4302-0196-0 (ISBN)

Lese- und Medienproben

Foundation ActionScript 3.0 with Flash CS3 and Flex -  Sean McSharry,  Steve Webster,  Gerald YardFace
Systemvoraussetzungen
35,30 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
This book teaches ActionScript  to both aspiring ActionScript developers and experienced ones who want to upgrade their knowledge to the new version. It details how to use ActionScript  through both Flash CS2 and Flex 2 (open source ActionScript developers should also be able to make use of the book). Coverage focuses on essential real world techniques and assumes no previous ActionScript knowledge. In addition, the book features a host of practical examples; reference sections are also included at the back of the book allowing the reader to easily look up syntax.

Sean McSharry has been a Flash developer and designer since 1999 (Flash 3). He runs the popular Flashcoder blog (Flashcoder.net/blog). He has consulted in many business sectors from oil exploration to banking to Internet protocol television (IPTV), for major industry leaders such as Microsoft and Adobe Consulting. He is an Adobe Certified Flash Developer and Designer and has worked on everything from banners to massive rich Internet applications. He has worked in Europe and America and is the director of creative research and development for AKQA in New York. He uses the entire Flash platform in his development (Flash, ActionScript, Flash Lite, Flash Media Server, etc.). He is a pre-release tester for many Adobe products and is actively involved in the Flash community. He strongly believes that Flash developers and designers should be as comfortable with and passionate about code as they are about aesthetics and design. 'Flash allows you to bring everything together in one development environment for many platforms. So to produce the best work you need to be skilled in coding, design, video, audio, stills production, etc. Even if you don't actually do them, you have to have a good understanding of them all if you want to produce the best work.'
If you want to create exciting dynamic web sites that will amaze your online audience, then the Flash platform is a great way to go, with it's many features, including powerful graphical and sound and video capabilities. To really harness the power of Flash though, you need to make use of ActionScript to provide dynamic effects, enable user interaction, and manipulate data.ActionScript 3.0, the Flash Platform's scripting language, offers a lot of new and powerful features. ActionScript is now a full-fledged programming language, with complete object-oriented capabilities, improved event handling, sound and video support, drawing capabilities, support for regular expressions, and much more.Whether you are a Flash designer wishing to add to your skill set or an experienced ActionScript developer who wants to get up to speed with the latest version, you'll find all you need to know in Foundation ActionScript 3.0 with Flash CS3 and Flex.This book covers all the essential techniques from the ground up, allowing you to get up and running quickly and easily. Starting with the fundamentals, you'll learn about using ActionScript objects, manipulating sound and video, and harnessing the power of regular expressions and XML.The book concludes with two case studies to consolidate what you've learned and to introduce some more advanced techniques. This will give you some grounding in the new and exciting world of ActionScript 3.0 and show you how it all fits together in larger applications, allowing you to go on and build your own professional sites.The sensible layout of the book makes it easy to find information about specific techniques. It doesn't aim to be an exhaustive reference, but rather focuses on the essential skills that will enable you to get up and running more quickly. With this book as your guide, you'll be creating killer Flash applications before you know it!

Sean McSharry has been a Flash developer and designer since 1999 (Flash 3). He runs the popular Flashcoder blog (Flashcoder.net/blog). He has consulted in many business sectors from oil exploration to banking to Internet protocol television (IPTV), for major industry leaders such as Microsoft and Adobe Consulting. He is an Adobe Certified Flash Developer and Designer and has worked on everything from banners to massive rich Internet applications. He has worked in Europe and America and is the director of creative research and development for AKQA in New York. He uses the entire Flash platform in his development (Flash, ActionScript, Flash Lite, Flash Media Server, etc.). He is a pre-release tester for many Adobe products and is actively involved in the Flash community. He strongly believes that Flash developers and designers should be as comfortable with and passionate about code as they are about aesthetics and design. "Flash allows you to bring everything together in one development environment for many platforms. So to produce the best work you need to be skilled in coding, design, video, audio, stills production, etc. Even if you don't actually do them, you have to have a good understanding of them all if you want to produce the best work."

Title Page 1
Copyright Page 2
CONTENTS AT A GLANCE 4
Table of Contents 5
ABOUT THE AUTHORS 15
ABOUT THE TECHNICAL REVIEWER 16
ABOUT THE COVER IMAGE DESIGNER 17
Chapter 1 GETTING STARTED WITH ACTIONSCRIPT 3.0 19
A brief history of ActionScript 20
Flash CS3 and Flex 2 20
ActionScript and object-oriented programming 22
The development process 22
Organizing your files 25
Adding ActionScript to your projects 26
Placing code on the timeline 26
Importing code from an external file 28
Specifying a document class 29
Linking library assets to external classes 30
Bouncing balls 33
Creating the Flash file 33
Creating the Ball class 35
Adding more balls 37
ActionScript in action 38
Summary 39
Chapter 2 ACTIONSCRIPT 3.0 FUNDAMENTALS 41
Statements and expressions 42
Introducing variables 43
Assigning a value to a variable 44
Retrieving the value of a variable 45
Naming your variables 47
Understanding data types 48
Boolean data type 49
Numeric data types 49
Constants 51
Performing operations 52
Arithmetic operators 52
Specifying precedence 53
String operations 54
Unary operations 54
Introducing arrays 55
Manipulating arrays 57
Making decisions 59
Introducing the if statement 59
Forming Boolean expressions 60
Booleans in conditionals 62
Using Boolean operators 63
Looping the loop 64
The while loop 65
The do . . . while loop 68
The for loop 69
Looping through an array 69
More for loops 70
Breaking out of a loop 71
Introducing functions 71
Creating a function 73
Returning a value from a function 73
Using function parameters 76
Providing a default value for function parameters 77
Allowing for variable parameters 77
Passing values and references 78
Function scope 80
Commenting your code 82
Bad vs. good comments 83
Commenting for documentation 84
Summary 84
Chapter 3 OBJECTS AND CLASSES 87
The iPod analogy 88
Working with objects 89
Creating objects using the new operator 89
Accessing properties and calling methods 90
Copying objects 91
Casting objects to a type 92
The Object object 94
Iterating over objects 96
Creating your first class 98
Choosing suitable names for your classes 99
Adding properties 100
Adding methods 102
Initializing your objects with a constructor method 105
Controlling access to properties and methods 107
Adding getter/setter methods 109
Creating read-only properties with getter methods 112
Static properties and methods 113
Taking advantage of inheritance 114
Overriding methods of the base class 117
Using packages to group your classes 119
Naming your packages 119
Importing a class from a package 120
Importing all classes in a given package 121
Resolving naming conflicts among imported classes 121
Removing dependency on timeline code 122
Summary 122
Chapter 4 WORKING WITH THE DISPLAY 124
Introducing the display list 125
Working with display objects 127
Manipulating display objects 131
Managing depth 135
Discovering the depth of objects 136
Manipulating the depth of objects 138
Swapping depths 139
Creating new display objects 141
Removing display objects from the display list 143
Specifying blend modes 143
Working with filters 145
Applying a filter to a display object 145
Applying filters in a specific order 150
Making changes to an existing filter 151
Removing an existing filter 155
Introducing the advanced filters 157
Accessing the stage 159
Using Stage properties 159
Making a movie full screen 159
Using Library resources 163
Loading from external files 166
Loading an external asset 166
Manipulating the loaded asset 169
Making things move 169
Copying animation from the timeline 169
Creating the animation 170
Copying the animation code 171
Looping the animation 174
Animating other properties 175
Understanding the animation XML 175
Summary 176
Chapter 5 CREATING VECTOR GRAPHICS WITH THEDRAWING API 178
Why we need a Drawing API 178
Understanding the Drawing API 181
Setting up Mr. Smiley 181
Drawing lines 183
Creating straight lines 183
Controlling the line style 185
Drawing curved lines 187
Drawing and filling shapes 188
Drawing primitive shapes 188
Creating custom shapes 190
Filling shapes with a solid color 191
Filling shapes with color gradients 194
Simplifying the code 198
Creating gradient line styles 200
Summary 206
Chapter 6 USER INTERACTION AND MORE WITH EVENTS 208
Understanding events 209
Listening for an event 210
Removing an event listener 211
Naming your event listener methods 212
Creating a simple drawing application 212
Setting up the canvas 212
Adding event listeners 214
Refreshing the screen 218
Using one event listener for multiple objects 219
Using events with the display list 219
Handling single and double mouse clicks 219
Handling mouse hover states 223
Responding to a rollover event 224
Making colors constants 228
Handling key presses 229
Setting up a keyboard drawing application 230
Handling crosshair movement 233
Preventing an event’sdefault action 238
Capturing and bubbling: the event flow 242
Listening for events in the bubble phase 243
Listening for events in the capture phase 244
Stopping an event from propagating 244
Removing capture phase event listeners 245
Summary 245
Chapter 7 WORKING WITH VIDEO 247
Video on the modern Web 247
The video experience 248
Where ActionScript comes in 249
Encoding your video 250
Capturing your video 251
Using the Flash Video Encoder 253
Delivering your video 257
Using ActionScript to play videos 260
Managing connections with the NetConnection class 262
Loading and controlling video with the NetStream class 263
Buffering your video 264
Playing your video 265
Pausing your video 265
Stopping your video 265
Fast-forwarding and rewinding your video 265
Creating video objects with the Video class 267
Creating camera objects with the Camera class 268
Handling video events 271
Mouse events 271
Status events 272
Metadata events 273
Cue point events 276
Building a video player 278
Setting up the project 279
Creating the Main.as file 280
Creating the Video.as file 280
Controlling the video player 283
Setting up the status text field 283
Implementing the loading progress bar 284
Creating the playhead bar 285
Handling the metadata 287
Handling cue points 288
Controlling the video on the stage 289
Adding button functionality 290
Finishing the Videos.as class 296
Creating a custom event 303
Summary 303
Chapter 8 USING AUDIO 306
Importing and converting sound files 307
Using iTunes 307
Converting to MP3 format 307
Adding ID3 information 308
Using Soundbooth 309
Using ActionScript to play sound 309
Accessing sound files with the Sound class 310
Controlling sound channels with the SoundChannel class 310
Doing security checks with the SoundLoaderContext class 311
Controlling volume and panning with the SoundTransform class 311
Controlling sounds globally with the SoundMixer class 312
Getting ID3 data with the ID3Info class 313
Using a microphone with the Microphone class 313
Understanding the basics of a sound player application 314
Preloading a buffer 315
Pausing sound 316
Stopping sound 317
Fast-forwarding and rewinding sound 318
Controlling volume 319
Controlling panning 320
Displaying the sound spectrum 320
Handling ID3 events 323
Building a sound player 325
Setting up the project 326
Creating the Main.as file 327
Creating the Sounds.as file 328
Loading the sound file 330
Buffering sound 331
Adding display items 331
Creating the loading progress bar 331
Creating the playhead bar 332
Adding the sound spectrum 334
Displaying ID3 track metadata 336
Controlling the audio as it plays 336
Adding button functionality 337
Handling button events 342
Controlling the sound volume and panning 346
Creating the custom event class 355
Summary 356
Chapter 9 WORKING WITH COMPONENTS 358
Just what are components? 359
Accessing your components 360
Adjusting parameters 360
Benefits of working with components 364
Exploring the Flash component framework 365
UI components 365
Video components 367
Going behind the scenes 368
Finding the files 369
Components directory 370
Component Source directory 371
Scripting interaction 374
Adding the components 375
Adding the ActionScript 377
Styling and skinning 382
Styling components 382
Setting up for changing styles 383
Setting styles for all components 384
Setting a style for all instances of a component 385
Setting the style for a single instance of a component 385
Skinning using the timeline 386
Skinning using classes 389
Creating a skin for the button’s up state 389
Creating skins for the button’s other states 390
Associating the skins with the buttons 391
Creating components from scratch 393
Creating the widget 393
Writing the component code 395
Handling events 396
Rotating the dial 397
Getting and setting dial values 398
Adding metatags 400
Turning the symbol into a component 401
Testing the component 402
Using third-party components 403
Summary 404
Chapter 10 REGULAR EXPRESSIONS 406
Why we need regular expressions 407
Introducing the RegExp class 409
The anatomy of a regular expression pattern 409
Introducing metacharacters 411
Using anchors to restrict the position of matches 411
Providing alternatives using alternation 412
Using character classes and character ranges 413
Matching any character using the dot metacharacter 414
Matching a number of occurrences using quantifiers 414
Matching zero or one occurrence 415
Matching zero or more occurrences 416
Matching one or more occurrences 416
How to prevent greedy quantifiers 416
Being more specific with bounds 417
Grouping patterns 418
Accessing matched strings with backreferences 419
Using backreferences with the String.replace() method 420
Using backreferences after the pattern has been matched 421
Understanding the e-mail regular expression pattern 422
Changing regular expression behavior with modifiers 423
Using the case-insensitive modifier 424
Using the global modifier 424
Using the multiline modifier 425
Using the dotall modifier 426
Using the extended modifier 426
Using variables to build a regular expression 427
Useful regular expressions 427
Regular expression resources 428
Summary 428
Chapter 11 USING XML 431
Understanding XML and E4X 432
XML document components 432
Root node 432
Elements 432
Attributes 433
Text nodes 433
E4X 434
Accessing an XML file 434
Creating an XML object 434
Loading an XML file 434
Getting XML from a remote source 436
Reading the XML 436
Reading the root node 436
Reading elements in an XML tree 436
Reading an XML element’s attributes 437
Searching XML 438
Searching for an attribute or element at any level 439
Reading text nodes 441
Modifying XML 442
Adding elements to an XML object 442
Removing elements and attributes from an XML object 445
Summary 445
Chapter 12 CASE STUDY:CREATING A DYNAMIC IMAGE VIEWER 447
An overview of the image viewer 448
Laying out the interface 449
Creating the document class 455
Loading image data 460
Loading the XML 462
Parsing the data 463
Accessing the data 464
Displaying images 466
Handling image selection 468
Scaling an image 470
Adding graphic enhancements 470
Changing the image label 471
Improving the thumbnail layout 471
Adding drop shadows 473
Creating an animated transition 475
Summary 479
Chapter 13 GETTING STARTED WITH FLEX 2 481
Introducing Flex 2 482
Understanding rich Internet applications 482
Meet the (Flex) family 482
The Flex framework 483
Flash Player 9 483
MXML 483
Flex 2 Software Development Kit 484
Flex Builder 2 484
Flex Data Services 484
Adobe AIR 485
Getting started with the Flex 2 SDK 485
Installing the Flex 2 SDK 485
Windows XP/Vista 486
Mac OS X 488
Linux 488
Finding a suitable editor 488
Building your first Flex 2 application 488
Getting started with Flex Builder 2 492
Understanding the Flex Builder 2 interface 492
Building your first Flex Builder 2 application 493
Creating a new Flex project 493
Working in Design view 495
Working in Source view 499
Summary 500
Chapter 14 FLEX BY EXAMPLE 502
Planning the application 503
Gathering the requirements 503
Creating the functional specification 504
Designing the UI 505
Designing the interaction 507
Designing the data and logic 507
Setting up the project 507
Creating the basic UI 509
Creating basic feed integration 512
Installing the XML syndication library 512
Creating the Subscription class 516
Testing the Subscription class 518
Loading the data 520
Allowing Subscription instances to be used for data binding 525
Creating the subscriptions list 528
Creating the articles data grid 531
Populating the Article panel 534
Completing the Subscriptions panel 535
Allowing users to subscribe to a feed 535
Laying out the SubscribeDialog component 536
Wiring up the buttons 537
Getting the feed 540
Allowing users to unsubscribe from a feed 546
Saving the subscriptions list between sessions 546
Refreshing the subscriptions list 549
Automatically refreshing the subscriptions list 549
Manually refreshing the subscriptions list 550
Completing the Articles and Article panels 552
Finishing the Articles panel 552
Finishing the Article panel 557
Improving the feed reader 559
Summary 560
INDEX 562

Erscheint lt. Verlag 31.7.2008
Zusatzinfo 450 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Grafik / Design Film- / Video-Bearbeitung
Mathematik / Informatik Informatik Web / Internet
Schlagworte ActionScript • ActionScript 3 • Adobe Flash • Audio • Design • Framework • interaction • language • Open Source • programming • Programming language • techniques • Video • Web Services • XML
ISBN-10 1-4302-0196-7 / 1430201967
ISBN-13 978-1-4302-0196-0 / 9781430201960
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 6,7 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
A comprehensive guide to designing modern, animated, and interactive …

von Joseph Labrecque

eBook Download (2023)
Packt Publishing (Verlag)
46,79