Macromedia Flash MX 2004 ActionScript Bible 9780764543548, 0764543547

* Provides in-depth information to the more than one million Flash developers who want to take their animations to the n

320 109 6MB

English Pages 987 Year 2004

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Team DDU......Page 1
Foreword......Page 12
Preface......Page 16
Acknowledgments......Page 22
Contents......Page 26
Part I: Conceptualizing Flash......Page 44
Considering Flash MX 2004 in Context......Page 46
Understanding the Capabilities of Flash MX 2004......Page 47
Improvements to the User Interface......Page 48
ActionScript......Page 49
Flash Player 7 Improvements......Page 51
Shared Libraries......Page 54
Understanding the Framework......Page 55
File Types in Flash MX 2004......Page 56
Applying Flash MX 2004......Page 57
Planning Flash Development......Page 58
Summary......Page 60
Expecting the Best Experience......Page 62
Flash Player Statistics......Page 64
To Flash or Not to Flash?......Page 65
Competing Technologies......Page 69
Scripting on the Client Side: JavaScript......Page 71
Transmitting and Storing Data......Page 72
Data-Driven Applications (or RIAs)......Page 79
Summary......Page 80
An Overview of Flash Development......Page 82
Design Documents......Page 83
Functional Specifications......Page 84
Making Flowcharts......Page 85
Flash as Specialty Content: Multipage HTML......Page 87
Using DHTML with Flash......Page 88
Internal Data Storage......Page 89
External Data Storage......Page 90
Naming Conventions......Page 92
Folder Hierarchies......Page 93
Using the Project Panel in Flash MX Pro 2004......Page 94
Establishing a Project and a Site......Page 95
Adding Files to the Project......Page 99
Committing and Editing Files in the Project......Page 100
Adding New Files to the Project......Page 102
Summary......Page 103
Part II: Laying the ActionScript Foundation......Page 106
Introducing ActionScript......Page 108
Creating Your First ActionScript......Page 109
Assigning Actions......Page 111
Opening the Actions Panel......Page 114
Working with the Actions Toolbox......Page 116
Working with the Script Navigator......Page 117
Working with the Script Pane......Page 118
Managing Scripts......Page 120
Setting Actions Panel Preferences......Page 121
Using Code Hinting......Page 123
Using the Help Panel......Page 125
Summary......Page 133
Understanding Datatypes......Page 134
Working with Strings......Page 135
Working with Numbers......Page 136
Using Variables......Page 137
Declaring Variables......Page 138
Naming Variables......Page 140
Using Expressions......Page 142
Working with Operators......Page 143
Working with Assignment Operators......Page 144
Working with Comparison Operators......Page 146
Working with Logical Operators......Page 148
Working with String Operators......Page 149
Working with Miscellaneous Operators......Page 150
Understanding Bitwise Operators......Page 152
Considering Operator Precedence......Page 157
Using Comments Effectively......Page 158
Understanding Statement Syntax......Page 159
Using Statements That Control Flow: Control Structures......Page 160
Summary......Page 166
Understanding Programming with Functions......Page 168
Defining Custom Functions......Page 169
Passing Parameters......Page 170
Working with the arguments Property......Page 172
Returning a Value from a Function......Page 174
Creating Function Literals......Page 176
Variable Scope......Page 177
Function Scope......Page 178
Creating Recursion......Page 179
Writing for Reusability......Page 180
Using Built-in Functions......Page 181
Creating Interval Functions......Page 182
Summary......Page 184
Understanding Object Blueprints......Page 186
Creating an Object......Page 187
Accessing Object Properties......Page 188
Working with Static Properties and Methods......Page 189
Adding New Object Methods......Page 190
Telling Objects to Talk to Themselves......Page 191
Displaying the Time with an Object......Page 192
Working with MovieClip Objects......Page 194
Displaying the Time Using a Movie Clip......Page 195
Creating Interval Methods......Page 196
Understanding the Object Class......Page 197
Accessing Associative Array Keys and Values......Page 198
Looping Through Object Properties......Page 199
Creating Watched Variables......Page 200
Working with the Classpath......Page 202
Creating a Simple Class......Page 204
Defining Properties for a Class......Page 205
Defining Methods for a Class......Page 208
Creating a Constructor......Page 209
Adding Static Properties to a Class......Page 210
Making Your First Class......Page 211
Working with Advanced Class Topics......Page 215
Organizing Your Classes with Packages......Page 216
Extending Classes......Page 218
Creating Interfaces......Page 220
Making Dynamic Classes......Page 222
Using the CustomActions Class......Page 223
Installing the Actions......Page 224
Removing Custom Actions......Page 226
Summary......Page 227
Troubleshooting Your Flash Application......Page 228
Encountering Bugs in Flash......Page 229
Finding Errors in Your Application......Page 230
Detecting Naming Conflicts and Problems......Page 231
Providing an Accurate Scoping Path......Page 233
Importing Images, MP3s, and Video......Page 234
Publishing Your Movies......Page 235
Fixing Blurry Text......Page 236
Considering External Issues......Page 237
Finding Help in the Flash Community......Page 238
Planning Before Development......Page 239
Testing Your Movie......Page 240
Working with Compatible Actions......Page 241
Working with Basic try/catch Statements......Page 243
Understanding Error Objects......Page 245
Using the Output Panel......Page 246
Debugging Using the Debugger......Page 250
An Exercise in Debugging......Page 256
Summary......Page 258
Part III: MovieClip, Button, and Drawing API......Page 260
Creating MovieClip and Button Objects at Authoring Time......Page 262
Targeting Nested Instances......Page 263
Working with Absolute Addressing......Page 264
Working with Relative Addressing......Page 265
Accessing Nested Instances with Array-Access Notation......Page 266
Handling Button Events......Page 267
Handling MovieClip Events......Page 268
Using MovieClip Objects as Buttons......Page 269
Practicing Targeting......Page 270
Working with Appearance Properties......Page 271
Working with Coordinates......Page 272
Working with Dimensions......Page 273
Working with Self-Describing Properties......Page 275
Tab-Switching, Focus, and Menus......Page 276
MovieClip-Specific Tab-Switching and Focus-Related Properties......Page 277
Affecting Timeline Playback......Page 278
Understanding Stacking Order Within Flash Movies......Page 279
Creating Duplicate MovieClip Objects......Page 281
Adding MovieClip Objects from the Library Programmatically......Page 282
Working with Init Objects......Page 284
Creating Empty MovieClip Objects......Page 285
Loading SWF Content......Page 286
Monitoring Loading......Page 288
Opening Web Pages......Page 290
Creating Draggable MovieClip Objects......Page 291
Telling Flash to Start Dragging a MovieClip......Page 292
Checking for Overlapping......Page 293
Working with Coordinate Spaces......Page 294
Practicing Attaching and Dragging MovieClip Objects......Page 295
Practicing Checking for Overlaps and Loading Content......Page 298
Summary......Page 303
Setting a Line Style......Page 304
Drawing a Straight Line......Page 305
Drawing a Curve......Page 306
Adding a Simple Gradient Fill......Page 307
Adding Complex Gradient Fills......Page 309
Getting Started with DrawingUtils......Page 313
Drawing Rectangles......Page 314
Drawing Regular Polygons......Page 315
Drawing Fills......Page 316
Practicing Dynamic Masking......Page 318
Practicing Responsive Objects......Page 321
Practicing Drawing......Page 330
Summary......Page 334
Part IV: The Core Classes......Page 336
Creating Ordered Structures......Page 338
Creating Arrays......Page 339
Adding Values to an Array......Page 340
Removing Elements from an Array......Page 342
Reading Data from Arrays......Page 344
Working with Parallel Arrays......Page 345
Working with Arrays of Objects......Page 347
Converting Arrays to Lists......Page 348
Extracting Subsets of Array Elements......Page 349
Sorting More Complexly......Page 350
Sorting Arrays of Associative Arrays......Page 355
Summary......Page 359
Integers and Floating-Point Numbers......Page 360
Other Bases for Numbers......Page 361
Converting Strings to Numbers......Page 362
Converting to a Number with Precision......Page 363
Dealing with Infinite Values......Page 364
Working with Number Instances......Page 365
Creating a NumberPlus Class......Page 366
Summary......Page 367
Learning About ActionScript Math......Page 368
Working with the Math Constants......Page 369
Rounding and Truncating Numbers......Page 370
Generating Random Numbers......Page 371
Finding the Greater or Lesser of Two Numbers......Page 372
Working with Exponents and Square Roots......Page 373
Using Trigonometric Functions in ActionScript......Page 374
Calculating Natural Logarithms and Exponentials......Page 377
Creating MathUtils......Page 378
Using Math to Draw and Animate......Page 379
Summary......Page 383
Working with Computer Dates......Page 384
Getting the Current Date and Time......Page 386
Making a Date Based on Year or Month......Page 387
Working with Date Objects......Page 389
get Methods......Page 391
set Methods......Page 393
Inherited Methods......Page 395
Working with Advanced Date and Time Issues......Page 396
Performing Date Math......Page 403
Displaying the Time and Date......Page 404
Summary......Page 408
Understanding Primitives and Objects......Page 410
Getting and Setting Primitive Values......Page 411
Escaping Characters......Page 412
Nonvisible Characters......Page 413
Avoiding Common Mistakes......Page 414
Working with Substring Values......Page 415
substring......Page 416
Finding Substrings......Page 417
Using Character Codes to Get Characters......Page 418
Converting a String into an Array......Page 419
Passing String Values to and from Applications......Page 420
Summary......Page 421
Part V: The Movie Classes......Page 422
Creating a New Object......Page 424
Understanding the Color Class......Page 426
Setting a Solid Color......Page 427
Retrieving Solid Color Information......Page 429
Controlling the Absolute Color of a Movie Clip......Page 431
Applying Advanced Color Effects to Movie Clips......Page 434
Summary......Page 436
Dynamic Text......Page 438
Making Text at Authoring Time......Page 439
Making Runtime Text......Page 441
Understanding Basic TextField Properties and Methods......Page 442
Adding Text......Page 443
Managing Multiline Text......Page 444
Resizing a TextField Object......Page 445
Setting Border and Background......Page 446
Managing Input......Page 447
Creating Password Text......Page 448
Changing Text Color......Page 449
Creating a Simple Notes Application......Page 450
Using HTML with TextField Objects......Page 452
Inserting Special Characters into HTML Fields......Page 453
Adding Hyperlinks to Text......Page 456
Calling ActionScript Functions from Text......Page 457
Embedding Content in Text......Page 458
Creating an HTML-Based Information Viewer......Page 460
Scrolling Text Vertically......Page 461
Scrolling Text Horizontally......Page 463
Detecting Focus Changes......Page 464
Detecting Scrolling......Page 465
Creating a Scrolling Text Viewer......Page 466
Detecting Scrolling......Page 468
Embedding Fonts......Page 469
Using Flash Device Fonts......Page 474
Inserting Special Characters into Editable Text Fields......Page 475
Creating a Random Letter Displayer......Page 476
Working with Focus......Page 478
Working with Selection......Page 480
Replacing Selected Text......Page 481
Changing Tab Order......Page 482
Summary......Page 483
Working with TextFormat......Page 484
Assigning Formatting to a TextField Object......Page 485
Understanding Formatting Properties......Page 487
Determining Text Metrics......Page 493
Getting the TextFormat......Page 494
Understanding CSS......Page 495
Applying Styles to Text......Page 497
Formatting an HTML Article with CSS......Page 498
Loading External CSS......Page 499
Formatting HTML with CSS Loaded from an External File......Page 500
Summary......Page 501
More Prebuilt Classes......Page 502
Using the Mouse Class to Control the Cursor......Page 503
Method Overview of the Mouse Class......Page 504
Method Overview of Mouse Listeners......Page 505
Showing and Hiding the Mouse Cursor......Page 508
Attaching a Custom Graphic to the Cursor......Page 510
Using updateAfterEvent() for Mouse Moves......Page 513
Using the Mouse Wheel to Control an Object's Position......Page 515
Property and Method Overview of the Key Class......Page 518
Capturing Keypresses......Page 520
Determining the Key Code......Page 526
Nudging a MovieClip Object with the Arrow Key......Page 529
Using setInterval() and onKeyDown for Keypresses......Page 532
Detecting Keypress Combinations......Page 536
Playing a Flash Animation with a Keypress......Page 539
Summary......Page 543
Controlling the Movie's Stage......Page 546
Property Overview of the Stage Class......Page 547
Working with the Width and Height of a Flash Movie......Page 551
Method Overview of the Stage Class......Page 555
Controlling Placement of Elements According to Stage Size......Page 556
Removing a Listener Object from the Stage Class......Page 559
Using the ContextMenu Class......Page 560
Controlling Flash Player's Built-in Menu......Page 561
Building Custom Menu Items with the ContextMenuItem Class......Page 563
Summary......Page 571
Setting the Clipboard Contents......Page 572
Showing the Flash Player Settings......Page 573
Using Code Pages......Page 574
Determining the Client Computer's Capabilities......Page 575
Getting Audio and Video Capabilities......Page 576
Determining Versions......Page 577
Getting Screen and Resolution Information......Page 578
Working with Player Security When Loading SWF Content......Page 579
Summary......Page 581
Problems with Web Browser Printing......Page 582
Expanding the Potential of Small Documents......Page 583
Retrieving the User's Page Settings with PrintJob.start()......Page 585
Determining the Print Target and Its Formatting Options......Page 588
Potential Problems with the Flash Printed Output......Page 596
Creating a Dialog Box for Print Notification......Page 597
Working with Hidden Content......Page 601
Summary......Page 603
Part VI: The Audio and Video Classes......Page 604
An Introduction to the Sound Class......Page 606
Understanding Sound Resources and Timelines......Page 607
Property and Method Overview of the Sound Class......Page 611
Properties of the Sound Class......Page 612
Reading an MP3 File's ID3 Tags with Sound.id3......Page 613
Loading Methods of the Sound Class......Page 614
Playback Methods of the Sound Class......Page 618
Transformation Methods of the Sound Class......Page 620
Creating and Playing a Linked Sound File......Page 623
Loading an External MP3 File......Page 626
Controlling the Volume of a Sound Object......Page 631
Applying Advanced Effects to Sound Objects......Page 635
Making a Looping Playlist......Page 638
Summary......Page 640
Working with Flash Video Files......Page 642
Making an FLV File in Flash MX 2004......Page 643
Using RTMP to Access FLV Files......Page 645
Using HTTP to Access FLV Files......Page 646
Loading FLV Files into a Flash Movie......Page 647
Displaying the NetStream Output in a Video Object......Page 648
Checking Status Messages from the NetStream Class......Page 650
Scripting Basic Controls for a NetStream Object......Page 652
Summary......Page 655
Part VII: The Data Classes......Page 656
Saving Data with Shared Objects......Page 658
Creating a Local Shared Object......Page 659
Saving the Shared Object to the Client......Page 660
Conflicts, Domains, and Paths......Page 663
Remembering States with Shared Objects......Page 664
Creating a Sending Movie......Page 669
Creating a Receiving Movie......Page 670
Sending and Receiving Across Domains......Page 671
Summary......Page 673
Working with XML......Page 674
Uses of XML......Page 675
Writing Well-Formed XML......Page 676
Tags......Page 677
Attributes......Page 678
DTD......Page 679
Using XML Objects......Page 680
Traversing the XML Tree......Page 681
Building a Document Tree......Page 687
Loading and Sending XML......Page 689
Loading Data......Page 693
Sending Data......Page 694
Setting Up a Policy File......Page 696
Working with a Proxy Script......Page 697
Summary......Page 698
Transmitting Data via HTTP......Page 700
The Socket Endpoints......Page 701
The Server......Page 702
Creating an XMLSocket Object......Page 703
Installing the Java Runtime Environment......Page 705
Setting Up the Client......Page 706
Summary......Page 713
Part VIII: Using Components......Page 714
Getting Started with V2 Components......Page 716
Introducing the Components Panel......Page 717
Naming Component Instances......Page 718
Working with the Component Inspector Panel......Page 719
Working with the Component APIs......Page 720
Working with Listener Objects......Page 721
Working with Common Component Functionality......Page 722
Working with Button Components......Page 724
Working with Label Components......Page 725
Working with TextInput Components......Page 726
Working with TextArea Components......Page 728
Working with CheckBox Components......Page 729
Working with RadioButton Components......Page 730
Working with ComboBox Components......Page 732
Working with List Components......Page 736
Working with NumericStepper Components......Page 739
Working with ScrollPane Components......Page 740
Working with Window Components......Page 742
Working with ProgressBar Components......Page 745
Working with Accordion Components......Page 747
Working with the Alert Component......Page 749
Working with DataGrid Components......Page 751
Working with DateChooser Components......Page 755
Working with DateField Components......Page 757
Working with Menu Components......Page 759
Working with MenuBar Components......Page 765
Working with Tree Components......Page 768
Summary......Page 772
Working with Component Styles......Page 774
Introducing UI Component Styles......Page 775
Working with Colors......Page 779
Setting Instance Styles with a Style Object......Page 780
Setting Global Styles......Page 781
Practicing Applying Styles......Page 782
Creating a FocusManager Instance......Page 784
Setting Focus Programmatically......Page 785
Setting Default Buttons......Page 786
Summary......Page 787
Understanding Component Anatomy......Page 788
Making Your First Component......Page 789
Dispatching Events......Page 793
Using Inspectable......Page 794
Using IconFile......Page 795
Practicing Making an Event Dispatching Component......Page 796
Building Components Based on the v2 UI Architecture......Page 798
Extending v2 Architecture Classes......Page 799
Practicing Making a v2 Architecture Component......Page 800
Working with Styles......Page 804
Practicing Working with Styles......Page 805
Summary......Page 808
Part IX: Working with Flash in Other Environments......Page 810
Understanding Flash and HTML......Page 812
Passing Initialization Values to Flash from HTML......Page 815
Sending JavaScript Calls with getURL......Page 816
Ensuring Complete Browser Compatibility......Page 817
Automated Player Detection......Page 819
Summary......Page 821
Standardizing Accessibility Concerns......Page 822
W3C Standards......Page 823
Reviewing Current Assistive Technologies......Page 824
JAWS......Page 825
Exploring the Accessibility Panel......Page 826
Using Keypress Actions......Page 831
Checking the State and Presence of a Screen-Reader......Page 832
Checking the User's Browser for Accessibility Compliance......Page 833
Scripting Accessibility Properties Dynamically......Page 834
Making the Most of Your Accessible Movie......Page 835
Summary......Page 836
Using the Stand-Alone Player......Page 838
Benefits of the Stand-Alone Environment......Page 839
Limitations of the Stand-Alone Environment......Page 840
Overview of Commands and Arguments......Page 841
Adding Controls to Projector Movies......Page 842
Preventing Access to the Desktop......Page 849
Expanding the Potential of the Stand-Alone Projector......Page 851
Summary......Page 852
Part X: Creating Flash Applications......Page 854
Conceptualizing the Master Movie and Flash Content......Page 856
Constructing a Flash Asset Architecture......Page 858
Overview of Objects and Methods......Page 864
Building a Basic Preloader for a Flash Movie......Page 867
Making a Multipurpose Preloader......Page 874
Using Shared Libraries for Font Management......Page 880
Preloading a Shared Library......Page 887
Summary......Page 888
Using LoadVars to Send and Load Data......Page 890
Loading Plain Text and HTML......Page 893
Loading XML......Page 896
Introducing Flash Remoting......Page 900
Getting Started with Flash Remoting......Page 901
Introducing Flash Remoting ActionScript......Page 902
Enabling Services for Flash Remoting......Page 903
Practicing Using Flash Remoting......Page 904
Summary......Page 907
Databinding......Page 908
Working with Web Services......Page 909
Using a WebServiceConnector Component......Page 910
Calling Web Services without WebServiceConnector......Page 912
Dealing with Security Issues......Page 914
Summary......Page 915
Using Forms......Page 916
List......Page 917
Making a Simple Form......Page 918
Using LoadVars to Send Data......Page 920
Using XML to Send Data......Page 921
Using the WebService Class to Submit Form Data......Page 923
Checking for Defined Values......Page 924
Practicing Data Validation......Page 925
Dynamic Form Data......Page 927
Prefilling a Form......Page 928
Summary......Page 930
Appendix A: What's on the CD-ROM......Page 932
Index......Page 936

Macromedia Flash MX 2004 ActionScript Bible
 9780764543548, 0764543547

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers