When was actionscript introduced
Chapter 4 examines this major change introduced by ActionScript 3. Still another example of improved consistency, all events—such as a mouse click or key press—are handled by event listeners in ActionScript 3.
The new event model is very powerful when combined with the display list, allowing mouse and keyboard events to propagate through multiple display objects. The event model is discussed in Chapter 3. It allows you to reference XML data the same way you reference properties of other objects, such as movie clips or buttons, using a similar syntax. This is comfortable territory when you remember that a movie clip called mc2 , nested inside a movie clip called mc1 , is referenced as mc1.
New text-processing options now allow for much finer control over text manipulation. For example, you can now find the contents of a particular line in a text field, the number of characters in that line, and the character at a specified point such as under the mouse.
This new engine provides a greater degree of text control, including traditional typographic features, automatic text flow, and even support for right-to-left and vertical text layouts and double-byte languages such as Chinese, Japanese, and Korean, among others.
Text is discussed in Chapter On a practical level, they improve programmatic control over both individual sounds and all sounds playing. Sounds are now placed into separate channels, making it easier to work with more than one discrete sound. Sounds are also funneled through a sound mixer for collective control. You can get the amplitude and frequency spectrum data from sounds during playback, as well as from microphone input.
Chapter 11 covers sound in detail. For more advanced needs, you can access raw binary data at runtime. Individual bytes of data can be read during download, during sound playback, or from bitmap data, to name a few examples.
These bytes can be stored in a large list and still be accessed quickly and efficiently. In a programming language, the word scope is sometimes used to define the realm in which an object, such as a movie clip, lives. A movie clip might exist in one part of a Flash movie but not another. For example, a child movie clip might be nested inside one of two movie clips found in the main timeline.
That nested movie clip exists within one clip but not the other. Its scope, therefore, is restricted to the movie clip in which it lives, or its parent. Programming structures have specific scopes, as well, and ActionScript 3. Most classes are sealed by default, meaning the compiler recognizes only those properties and methods defined at compile time.
This improves memory usage and performance. However, if you need to add properties to an instance of a class at runtime for example , you can still use dynamic classes such as the MovieClip and Object , and you can make your own custom classes dynamic.
Additionally, namespaces, including the ability to define custom namespaces, allow finer control over classes and XML manipulation. However, ActionScript 3. AIR is the Adobe Integrated Runtime application, a sophisticated way of delivering your applications to the computer desktop, rather than through a web browser. The existence of AIR and Flex means that the scripting skills you develop using Flash Professional will be largely applicable in other areas of the Flash Platform, extending your reach as a programmer.
There are, however, some differences between these technologies that are important to understand when examining the big picture of cross-application scripting. For instance, each technology adds some features that are not available to the others.
Using a feature that is specific to AIR or Flex, for example, means that your code may not compile in Flash Professional. The thing to keep in mind is that the ActionScript 3. This book is written for readers who have some familiarity with scripting but are new to ActionScript 3.
See the Preface for more information about this expectation. While virtually all of the code in the book applies to any tool that supports ActionScript 3. Much discussion has been made over the pros and cons of procedural and object-oriented programming, and many who are new to ActionScript 3.
This is not the case. ActionScript started as a sequential programming language, meaning that scripting was limited to a linear sequence of instructions telling Flash what to do in a step-by-step manner. This approach to scripting was not very flexible and did not promote reuse. As the language evolved, it became a procedural programming language. Like sequential programming, procedural programming relied on a step-by-step set of instructions, but introduced a more structured, modular approach to scripting.
Procedures, otherwise known as functions or sometimes subroutines , could be executed again and again as needed from different parts of a project, without copying and pasting copies of the code into the ongoing sequence of instructions. This modularity promoted reuse, and made the code easier to edit and more efficient.
Scripters in search of an even greater degree of modularity and reuse gravitated toward object-oriented programming. OOP languages create programs that are a collection of objects.
Objects are individual instances of classes —collections of code that are self-contained and do not materially alter or disrupt each other.
Creating an instance of a class, also referred to as instantiation , is much like creating an instance of a library symbol in Flash Professional. Just like movie clips dragged from the library onto the stage, multiple instances of that movie clip symbol can be altered without affecting one another, and without affecting the original from which they were derived. Using OOP, however, you can extend this idea much further.
One example of extending an object-oriented system is the use of inheritance —the ability to derive classes from other classes, passing on specific characteristics from the base class, or parent class.
The programming terms parent , child , sibling , ancestor , and similar words and phrases mean much the same as they do when used to describe families. One simple example occurs when referring to symbol instances such as movie clips, which can be nested within each other. The upper- or outermost movie clip is sometimes referred to as the parent there is even an ActionScript 3.
Similarly, two movie clips at the same hierarchical level are siblings, and clips that are more than one parent up the chain of nested clips are called ancestors. In general, if you liken these terms to their everyday uses, referring to families, you will readily grasp their meanings.
Consider, for instance, designing an OOP application that simulates a set of transportation vehicles. You might start with a generic Vehicle class that includes traits common to all vehicles, such as the basic physics of movement.
These classes would alter or introduce vehicle traits, making them specific to ground, water, and air travel, respectively. However, these classes might not yet be complete enough to represent an actual vehicle. Depending on the complexity of your system, you can carry on this process, creating individual models with individual settings for fuel consumption, friction, and so on.
As you can probably imagine, this approach to development adds additional power, flexibility, and prospects for reuse. These benefits, among others, sometimes position object-oriented programming as the best approach to a problem. However, as we implied at the start of this section, there is a tendency among some programmers to believe that OOP is the best solution to all problems or, effectively, the only solution.
This is flat-out untrue. OOP is often best for large projects or for working with a team of programmers, but it can be overkill for small projects. Additionally, for the uninitiated, it can significantly increase the learning curve and distract from key topical concepts during your studies. In short, OOP is not always the best tool for the job.
Procedural programming still has its place, and Flash Professional allows you to explore and employ both programming paradigms. This book attempts to introduce material using both procedural and OOP approaches where appropriate. Using object-oriented practices is a fine goal, and one that we will encourage. However, we will try first to use simple procedural syntax to focus on the material central to each chapter, highlighting syntax and explaining how and why each topic should be addressed in code.
In general terms, we will focus on procedural programming prior to Chapter 6. Chapter 6 introduces OOP using a simplified version of the vehicle metaphor and serves as a transition chapter between procedural and OOP practices.
Beginning with Chapter 7 , chapters will introduce new concepts using simple timeline syntax and, when appropriate, include an applied OOP example. Depth management is automatic. Methods are provided for specifying and managing the stacking order of objects. The Loader class provides a single mechanism for loading SWF files and image assets and provides a way to access detailed information about loaded content.
The URLLoaderclass provides a separate mechanism for loading text and binary data in data-driven applications. The Socket class provides a means to read and write binary data to server sockets in any format. Various APIs provide low-level access to data. For data that is being downloaded, the URLStream class provides access to data as raw binary data while it is being downloaded.
The ByteArray class lets you optimize reading, writing, and working with binary data. Security APIs provide information about the security privileges of a SWF file or loaded content, enabling you to handle security errors. The TextLineMetrics class provides detailed metrics for a line of text within a text field; it replaces the TextFormat.
The TextField class contains low-level methods that provide specific information about a line of text or a single character in a text field. For example, the getCharBoundaries method returns a rectangle representing the bounding box of a character. The getCharIndexAtPoint method returns the index of the character at a specified point. The getFirstCharInParagraph method returns the index of the first character in a paragraph. Line-level methods include getLineLength , which returns the number of characters in a specified line of text, and getLineText , which returns the text of the specified line.
The Font class provides a means to manage embedded fonts in SWF files. For even lower-level control over text, the classes in the flash. This set of classes provide low-level control over text and are designed for creating text frameworks and components.
Adobe Flash Platform. View Help PDF 2. Introduction to ActionScript 3. Core language features The core language defines the basic building blocks of the programming language, such as statements, expressions, conditions, loops, and types. Run-time exceptions ActionScript 3.
Run-time types In ActionScript 3. Sealed classes ActionScript 3. Method closures ActionScript 3. Regular expressions ActionScript 3.
Find your dream job. Get on promotion fasstrack and increase tour lifetime salary. Explore A structured search through millions of jobs. Job Interview Training Skyrocket your resume, interview performance, and salary negotiation skills.
Find my next job. Resume Templates Choose resume template and create your resume. Cover Letter Templates Choose cover letter template and write your cover letter.
0コメント