Macromedia Flash MX 2004 ActionScript Bible 0764543547

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

335 12 6MB

English Pages 959 Year 2004

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Team DDU......Page 0
Contents......Page 2
Considering Flash MX 2004 in Context......Page 18
Understanding the Capabilities of Flash MX 2004......Page 19
Improvements to the User Interface......Page 20
ActionScript......Page 21
Flash Player 7 Improvements......Page 23
Shared Libraries......Page 26
Understanding the Framework......Page 27
File Types in Flash MX 2004......Page 28
Applying Flash MX 2004......Page 29
Planning Flash Development......Page 30
Summary......Page 32
Expecting the Best Experience......Page 34
Flash Player Statistics......Page 36
To Flash or Not to Flash?......Page 37
Competing Technologies......Page 41
Scripting on the Client Side: JavaScript......Page 43
Transmitting and Storing Data......Page 44
Data-Driven Applications (or RIAs)......Page 51
Summary......Page 52
An Overview of Flash Development......Page 54
Design Documents......Page 55
Functional Specifications......Page 56
Making Flowcharts......Page 57
Flash as Specialty Content: Multipage HTML......Page 59
Using DHTML with Flash......Page 60
Internal Data Storage......Page 61
External Data Storage......Page 62
Naming Conventions......Page 64
Folder Hierarchies......Page 65
Using the Project Panel in Flash MX Pro 2004......Page 66
Establishing a Project and a Site......Page 67
Adding Files to the Project......Page 71
Committing and Editing Files in the Project......Page 72
Adding New Files to the Project......Page 74
Summary......Page 75
Part II: Laying the ActionScript Foundation......Page 78
Introducing ActionScript......Page 80
Creating Your First ActionScript......Page 81
Assigning Actions......Page 83
Opening the Actions Panel......Page 86
Working with the Actions Toolbox......Page 88
Working with the Script Navigator......Page 89
Working with the Script Pane......Page 90
Managing Scripts......Page 92
Setting Actions Panel Preferences......Page 93
Using Code Hinting......Page 95
Using the Help Panel......Page 97
Summary......Page 105
Understanding Datatypes......Page 106
Working with Strings......Page 107
Working with Numbers......Page 108
Using Variables......Page 109
Declaring Variables......Page 110
Naming Variables......Page 112
Using Expressions......Page 114
Working with Operators......Page 115
Working with Assignment Operators......Page 116
Working with Comparison Operators......Page 118
Working with Logical Operators......Page 120
Working with String Operators......Page 121
Working with Miscellaneous Operators......Page 122
Understanding Bitwise Operators......Page 124
Considering Operator Precedence......Page 129
Using Comments Effectively......Page 130
Understanding Statement Syntax......Page 131
Using Statements That Control Flow: Control Structures......Page 132
Summary......Page 138
Understanding Programming with Functions......Page 140
Defining Custom Functions......Page 141
Passing Parameters......Page 142
Working with the arguments Property......Page 144
Returning a Value from a Function......Page 146
Creating Function Literals......Page 148
Variable Scope......Page 149
Function Scope......Page 150
Creating Recursion......Page 151
Writing for Reusability......Page 152
Using Built-in Functions......Page 153
Creating Interval Functions......Page 154
Summary......Page 156
Understanding Object Blueprints......Page 158
Creating an Object......Page 159
Accessing Object Properties......Page 160
Working with Static Properties and Methods......Page 161
Adding New Object Methods......Page 162
Telling Objects to Talk to Themselves......Page 163
Displaying the Time with an Object......Page 164
Working with MovieClip Objects......Page 166
Displaying the Time Using a Movie Clip......Page 167
Creating Interval Methods......Page 168
Understanding the Object Class......Page 169
Accessing Associative Array Keys and Values......Page 170
Looping Through Object Properties......Page 171
Creating Watched Variables......Page 172
Working with the Classpath......Page 174
Creating a Simple Class......Page 176
Defining Properties for a Class......Page 177
Defining Methods for a Class......Page 180
Creating a Constructor......Page 181
Adding Static Properties to a Class......Page 182
Making Your First Class......Page 183
Working with Advanced Class Topics......Page 187
Organizing Your Classes with Packages......Page 188
Extending Classes......Page 190
Creating Interfaces......Page 192
Making Dynamic Classes......Page 194
Using the CustomActions Class......Page 195
Installing the Actions......Page 196
Removing Custom Actions......Page 198
Summary......Page 199
Troubleshooting Your Flash Application......Page 200
Encountering Bugs in Flash......Page 201
Finding Errors in Your Application......Page 202
Detecting Naming Conflicts and Problems......Page 203
Providing an Accurate Scoping Path......Page 205
Importing Images, MP3s, and Video......Page 206
Publishing Your Movies......Page 207
Fixing Blurry Text......Page 208
Considering External Issues......Page 209
Finding Help in the Flash Community......Page 210
Planning Before Development......Page 211
Testing Your Movie......Page 212
Working with Compatible Actions......Page 213
Working with Basic try/catch Statements......Page 215
Understanding Error Objects......Page 217
Using the Output Panel......Page 218
Debugging Using the Debugger......Page 222
An Exercise in Debugging......Page 228
Summary......Page 230
Part III: MovieClip, Button, and Drawing API......Page 232
Creating MovieClip and Button Objects at Authoring Time......Page 234
Targeting Nested Instances......Page 235
Working with Absolute Addressing......Page 236
Working with Relative Addressing......Page 237
Accessing Nested Instances with Array-Access Notation......Page 238
Handling Button Events......Page 239
Handling MovieClip Events......Page 240
Using MovieClip Objects as Buttons......Page 241
Practicing Targeting......Page 242
Working with Appearance Properties......Page 243
Working with Coordinates......Page 244
Working with Dimensions......Page 245
Working with Self-Describing Properties......Page 247
Tab-Switching, Focus, and Menus......Page 248
MovieClip-Specific Tab-Switching and Focus-Related Properties......Page 249
Affecting Timeline Playback......Page 250
Understanding Stacking Order Within Flash Movies......Page 251
Creating Duplicate MovieClip Objects......Page 253
Adding MovieClip Objects from the Library Programmatically......Page 254
Working with Init Objects......Page 256
Creating Empty MovieClip Objects......Page 257
Loading SWF Content......Page 258
Monitoring Loading......Page 260
Opening Web Pages......Page 262
Creating Draggable MovieClip Objects......Page 263
Telling Flash to Start Dragging a MovieClip......Page 264
Checking for Overlapping......Page 265
Working with Coordinate Spaces......Page 266
Practicing Attaching and Dragging MovieClip Objects......Page 267
Practicing Checking for Overlaps and Loading Content......Page 270
Summary......Page 275
Setting a Line Style......Page 276
Drawing a Straight Line......Page 277
Drawing a Curve......Page 278
Adding a Simple Gradient Fill......Page 279
Adding Complex Gradient Fills......Page 281
Getting Started with DrawingUtils......Page 285
Drawing Rectangles......Page 286
Drawing Regular Polygons......Page 287
Drawing Fills......Page 288
Practicing Dynamic Masking......Page 290
Practicing Responsive Objects......Page 293
Practicing Drawing......Page 302
Summary......Page 306
Part IV: The Core Classes......Page 308
Creating Ordered Structures......Page 310
Creating Arrays......Page 311
Adding Values to an Array......Page 312
Removing Elements from an Array......Page 314
Reading Data from Arrays......Page 316
Working with Parallel Arrays......Page 317
Working with Arrays of Objects......Page 319
Converting Arrays to Lists......Page 320
Extracting Subsets of Array Elements......Page 321
Sorting More Complexly......Page 322
Sorting Arrays of Associative Arrays......Page 327
Summary......Page 331
Integers and Floating-Point Numbers......Page 332
Other Bases for Numbers......Page 333
Converting Strings to Numbers......Page 334
Converting to a Number with Precision......Page 335
Dealing with Infinite Values......Page 336
Working with Number Instances......Page 337
Creating a NumberPlus Class......Page 338
Summary......Page 339
Learning About ActionScript Math......Page 340
Working with the Math Constants......Page 341
Rounding and Truncating Numbers......Page 342
Generating Random Numbers......Page 343
Finding the Greater or Lesser of Two Numbers......Page 344
Working with Exponents and Square Roots......Page 345
Using Trigonometric Functions in ActionScript......Page 346
Calculating Natural Logarithms and Exponentials......Page 349
Creating MathUtils......Page 350
Using Math to Draw and Animate......Page 351
Summary......Page 355
Working with Computer Dates......Page 356
Getting the Current Date and Time......Page 358
Making a Date Based on Year or Month......Page 359
Working with Date Objects......Page 361
get Methods......Page 363
set Methods......Page 365
Inherited Methods......Page 367
Working with Advanced Date and Time Issues......Page 368
Performing Date Math......Page 375
Displaying the Time and Date......Page 376
Summary......Page 380
Understanding Primitives and Objects......Page 382
Getting and Setting Primitive Values......Page 383
Escaping Characters......Page 384
Nonvisible Characters......Page 385
Avoiding Common Mistakes......Page 386
Working with Substring Values......Page 387
substring......Page 388
Finding Substrings......Page 389
Using Character Codes to Get Characters......Page 390
Converting a String into an Array......Page 391
Passing String Values to and from Applications......Page 392
Summary......Page 393
Part V: The Movie Classes......Page 394
Creating a New Object......Page 396
Understanding the Color Class......Page 398
Setting a Solid Color......Page 399
Retrieving Solid Color Information......Page 401
Controlling the Absolute Color of a Movie Clip......Page 403
Applying Advanced Color Effects to Movie Clips......Page 406
Summary......Page 408
Dynamic Text......Page 410
Making Text at Authoring Time......Page 411
Making Runtime Text......Page 413
Understanding Basic TextField Properties and Methods......Page 414
Adding Text......Page 415
Managing Multiline Text......Page 416
Resizing a TextField Object......Page 417
Setting Border and Background......Page 418
Managing Input......Page 419
Creating Password Text......Page 420
Changing Text Color......Page 421
Creating a Simple Notes Application......Page 422
Using HTML with TextField Objects......Page 424
Inserting Special Characters into HTML Fields......Page 425
Adding Hyperlinks to Text......Page 428
Calling ActionScript Functions from Text......Page 429
Embedding Content in Text......Page 430
Creating an HTML-Based Information Viewer......Page 432
Scrolling Text Vertically......Page 433
Scrolling Text Horizontally......Page 435
Detecting Focus Changes......Page 436
Detecting Scrolling......Page 437
Creating a Scrolling Text Viewer......Page 438
Detecting Scrolling......Page 440
Embedding Fonts......Page 441
Using Flash Device Fonts......Page 446
Inserting Special Characters into Editable Text Fields......Page 447
Creating a Random Letter Displayer......Page 448
Working with Focus......Page 450
Working with Selection......Page 452
Replacing Selected Text......Page 453
Changing Tab Order......Page 454
Summary......Page 455
Working with TextFormat......Page 456
Assigning Formatting to a TextField Object......Page 457
Understanding Formatting Properties......Page 459
Determining Text Metrics......Page 465
Getting the TextFormat......Page 466
Understanding CSS......Page 467
Applying Styles to Text......Page 469
Formatting an HTML Article with CSS......Page 470
Loading External CSS......Page 471
Formatting HTML with CSS Loaded from an External File......Page 472
Summary......Page 473
More Prebuilt Classes......Page 474
Using the Mouse Class to Control the Cursor......Page 475
Method Overview of the Mouse Class......Page 476
Method Overview of Mouse Listeners......Page 477
Showing and Hiding the Mouse Cursor......Page 480
Attaching a Custom Graphic to the Cursor......Page 482
Using updateAfterEvent() for Mouse Moves......Page 485
Using the Mouse Wheel to Control an Object's Position......Page 487
Property and Method Overview of the Key Class......Page 490
Capturing Keypresses......Page 492
Determining the Key Code......Page 498
Nudging a MovieClip Object with the Arrow Key......Page 501
Using setInterval() and onKeyDown for Keypresses......Page 504
Detecting Keypress Combinations......Page 508
Playing a Flash Animation with a Keypress......Page 511
Summary......Page 515
Controlling the Movie's Stage......Page 518
Property Overview of the Stage Class......Page 519
Working with the Width and Height of a Flash Movie......Page 523
Method Overview of the Stage Class......Page 527
Controlling Placement of Elements According to Stage Size......Page 528
Removing a Listener Object from the Stage Class......Page 531
Using the ContextMenu Class......Page 532
Controlling Flash Player's Built-in Menu......Page 533
Building Custom Menu Items with the ContextMenuItem Class......Page 535
Summary......Page 543
Setting the Clipboard Contents......Page 544
Showing the Flash Player Settings......Page 545
Using Code Pages......Page 546
Determining the Client Computer's Capabilities......Page 547
Getting Audio and Video Capabilities......Page 548
Determining Versions......Page 549
Getting Screen and Resolution Information......Page 550
Working with Player Security When Loading SWF Content......Page 551
Summary......Page 553
Problems with Web Browser Printing......Page 554
Expanding the Potential of Small Documents......Page 555
Retrieving the User's Page Settings with PrintJob.start()......Page 557
Determining the Print Target and Its Formatting Options......Page 560
Potential Problems with the Flash Printed Output......Page 568
Creating a Dialog Box for Print Notification......Page 569
Working with Hidden Content......Page 573
Summary......Page 575
Part VI: The Audio and Video Classes......Page 576
An Introduction to the Sound Class......Page 578
Understanding Sound Resources and Timelines......Page 579
Property and Method Overview of the Sound Class......Page 583
Properties of the Sound Class......Page 584
Reading an MP3 File's ID3 Tags with Sound.id3......Page 585
Loading Methods of the Sound Class......Page 586
Playback Methods of the Sound Class......Page 590
Transformation Methods of the Sound Class......Page 592
Creating and Playing a Linked Sound File......Page 595
Loading an External MP3 File......Page 598
Controlling the Volume of a Sound Object......Page 603
Applying Advanced Effects to Sound Objects......Page 607
Making a Looping Playlist......Page 610
Summary......Page 612
Working with Flash Video Files......Page 614
Making an FLV File in Flash MX 2004......Page 615
Using RTMP to Access FLV Files......Page 617
Using HTTP to Access FLV Files......Page 618
Loading FLV Files into a Flash Movie......Page 619
Displaying the NetStream Output in a Video Object......Page 620
Checking Status Messages from the NetStream Class......Page 622
Scripting Basic Controls for a NetStream Object......Page 624
Summary......Page 627
Part VII: The Data Classes......Page 628
Saving Data with Shared Objects......Page 630
Creating a Local Shared Object......Page 631
Saving the Shared Object to the Client......Page 632
Conflicts, Domains, and Paths......Page 635
Remembering States with Shared Objects......Page 636
Creating a Sending Movie......Page 641
Creating a Receiving Movie......Page 642
Sending and Receiving Across Domains......Page 643
Summary......Page 645
Working with XML......Page 646
Uses of XML......Page 647
Writing Well-Formed XML......Page 648
Tags......Page 649
Attributes......Page 650
DTD......Page 651
Using XML Objects......Page 652
Traversing the XML Tree......Page 653
Building a Document Tree......Page 659
Loading and Sending XML......Page 661
Loading Data......Page 665
Sending Data......Page 666
Setting Up a Policy File......Page 668
Working with a Proxy Script......Page 669
Summary......Page 670
Transmitting Data via HTTP......Page 672
The Socket Endpoints......Page 673
The Server......Page 674
Creating an XMLSocket Object......Page 675
Installing the Java Runtime Environment......Page 677
Setting Up the Client......Page 678
Summary......Page 685
Part VIII: Using Components......Page 686
Getting Started with V2 Components......Page 688
Introducing the Components Panel......Page 689
Naming Component Instances......Page 690
Working with the Component Inspector Panel......Page 691
Working with the Component APIs......Page 692
Working with Listener Objects......Page 693
Working with Common Component Functionality......Page 694
Working with Button Components......Page 696
Working with Label Components......Page 697
Working with TextInput Components......Page 698
Working with TextArea Components......Page 700
Working with CheckBox Components......Page 701
Working with RadioButton Components......Page 702
Working with ComboBox Components......Page 704
Working with List Components......Page 708
Working with NumericStepper Components......Page 711
Working with ScrollPane Components......Page 712
Working with Window Components......Page 714
Working with ProgressBar Components......Page 717
Working with Accordion Components......Page 719
Working with the Alert Component......Page 721
Working with DataGrid Components......Page 723
Working with DateChooser Components......Page 727
Working with DateField Components......Page 729
Working with Menu Components......Page 731
Working with MenuBar Components......Page 737
Working with Tree Components......Page 740
Summary......Page 744
Working with Component Styles......Page 746
Introducing UI Component Styles......Page 747
Working with Colors......Page 751
Setting Instance Styles with a Style Object......Page 752
Setting Global Styles......Page 753
Practicing Applying Styles......Page 754
Creating a FocusManager Instance......Page 756
Setting Focus Programmatically......Page 757
Setting Default Buttons......Page 758
Summary......Page 759
Understanding Component Anatomy......Page 760
Making Your First Component......Page 761
Dispatching Events......Page 765
Using Inspectable......Page 766
Using IconFile......Page 767
Practicing Making an Event Dispatching Component......Page 768
Building Components Based on the v2 UI Architecture......Page 770
Extending v2 Architecture Classes......Page 771
Practicing Making a v2 Architecture Component......Page 772
Working with Styles......Page 776
Practicing Working with Styles......Page 777
Summary......Page 780
Part IX: Working with Flash in Other Environments......Page 782
Understanding Flash and HTML......Page 784
Passing Initialization Values to Flash from HTML......Page 787
Sending JavaScript Calls with getURL......Page 788
Ensuring Complete Browser Compatibility......Page 789
Automated Player Detection......Page 791
Summary......Page 793
Standardizing Accessibility Concerns......Page 794
W3C Standards......Page 795
Reviewing Current Assistive Technologies......Page 796
JAWS......Page 797
Exploring the Accessibility Panel......Page 798
Using Keypress Actions......Page 803
Checking the State and Presence of a Screen-Reader......Page 804
Checking the User's Browser for Accessibility Compliance......Page 805
Scripting Accessibility Properties Dynamically......Page 806
Making the Most of Your Accessible Movie......Page 807
Summary......Page 808
Using the Stand-Alone Player......Page 810
Benefits of the Stand-Alone Environment......Page 811
Limitations of the Stand-Alone Environment......Page 812
Overview of Commands and Arguments......Page 813
Adding Controls to Projector Movies......Page 814
Preventing Access to the Desktop......Page 821
Expanding the Potential of the Stand-Alone Projector......Page 823
Summary......Page 824
Part X: Creating Flash Applications......Page 826
Conceptualizing the Master Movie and Flash Content......Page 828
Constructing a Flash Asset Architecture......Page 830
Overview of Objects and Methods......Page 836
Building a Basic Preloader for a Flash Movie......Page 839
Making a Multipurpose Preloader......Page 846
Using Shared Libraries for Font Management......Page 852
Preloading a Shared Library......Page 859
Summary......Page 860
Using LoadVars to Send and Load Data......Page 862
Loading Plain Text and HTML......Page 865
Loading XML......Page 868
Introducing Flash Remoting......Page 872
Getting Started with Flash Remoting......Page 873
Introducing Flash Remoting ActionScript......Page 874
Enabling Services for Flash Remoting......Page 875
Practicing Using Flash Remoting......Page 876
Summary......Page 879
Databinding......Page 880
Working with Web Services......Page 881
Using a WebServiceConnector Component......Page 882
Calling Web Services without WebServiceConnector......Page 884
Dealing with Security Issues......Page 886
Summary......Page 887
Using Forms......Page 888
List......Page 889
Making a Simple Form......Page 890
Using LoadVars to Send Data......Page 892
Using XML to Send Data......Page 893
Using the WebService Class to Submit Form Data......Page 895
Checking for Defined Values......Page 896
Practicing Data Validation......Page 897
Dynamic Form Data......Page 899
Prefilling a Form......Page 900
Summary......Page 902
Appendix A: What's on the CD-ROM......Page 904
Index......Page 908

Macromedia Flash MX 2004 ActionScript Bible
 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