« Home « Chủ đề actionscript

Chủ đề : actionscript


Có 40+ tài liệu thuộc chủ đề "actionscript"

Học Actionscript 3.0 - p 16

tailieu.vn

Both compact and pickup are set to the same initial x value (lines 15 and 21), and pickup is given a different y value (line 22) so you can easily see both vehicles once they are added to the display list (lines 17 and 23).. The custom methods for both instances are called right away (lines 18 and 24), but...

Học Actionscript 3.0 - p 17

tailieu.vn

Although we’ll expand the explanation as this sec- tion evolves, you can start by thinking of polymorphism as a design practice that allows you to use objects of different types in a uniform manner. We’ll work with interfaces in a moment but, for now, think of them as rulebooks for classes. An interface is nothing more than a list of...

Học Actionscript 3.0 - p 18

tailieu.vn

In the next code segment, the build() method uses a for loop to add each button to the navigation bar. The loop first creates an instance of the MenuButtonMain class, passing the name of the button as a string for the but- ton’s label. This string comes from the button array passed into the construc- tor from the document class,...

Học Actionscript 3.0 - p 19

tailieu.vn

In the quest for more expressive animation, you will find that adding physics to animations, games, and similar projects can really elevate them to another level of user enjoyment. What happens when you toss a ball into the air? It goes up, starts to slow down as gravity affects its rate of ascent, it stops momentarily at the top of...

Học Actionscript 3.0 - p 20

tailieu.vn

However, the direction in the previous example was determined by changing x and y coordinates. A radian is the angle defined by moving along the outside of the circle only for a distance as long as the circle’s radius, as seen in Figure 7-4. Math.PI /180). Math.PI. In the upcoming example, we’ll write utility functions for this pur- pose that...

Học Actionscript 3.0 - p 21

tailieu.vn

The value of the angle is converted from degrees to radians using deg2rad. the utility function we’ve discussed before, at the end of the script.. The cosine of the current angle times the radius of the circle determines the x coordinate, and the sine of the angle multiplied by the circle’s radius calculates the y coordinate (lines 16 and 17).....

Học Actionscript 3.0 - p 22

tailieu.vn

The last thing we want to mention in this chapter is a companion website post about a feature that’s a bit out of the ordinary. As discussed multiple times in prior chapters, one of the greatest benefits of learning object-oriented programming is the ability to quickly and easily reuse code. To that end, we’re going to evolve a small library...

Học Actionscript 3.0 - p 23

tailieu.vn

In addition to applying gradients to fills and lines, you can use bitmaps to decorate your drawing’s fills and lines. Both the beginBitmapFill() and lineBitmapStyle() methods we cover in this section use instances of the BitmapData class. So, any time we need such an instance in the following examples, using a linkage class with an imported bitmap will fit the...

Học Actionscript 3.0 - p 24

tailieu.vn

The last three values in the matrix, u, v, and w, are not used in ActionScript and can be ignored.. MatrixTransformer note in the “Calculating changes in points after transformations”. The following script, found in the matrix_skew_1.fla source file, creates a rectangle with the Graphics class and then skews it.. To start with, lines 1 through 7 create a translucent...

Học Actionscript 3.0 - p 25

tailieu.vn

3 import flash.display.Sprite;. 4 import flash.display.GradientType;. 5 import flash.geom.Matrix;. 6 import flash.display.Graphics;. In addition to the aforementioned arrays, the method also requires a size for the artwork (100 for both components) and, optionally, a rotation (90 degrees, in the case of the overlay, sent to the method in line 28). The rotation value can be omitted from the method call...

Học Actionscript 3.0 - p 26

tailieu.vn

To create a bitmap data object with transparency, you must change the third parameter of the class constructor to true and then reduce the opacity of the color value. The first pair of characters in the hexadecimal number (from left to right) represents alpha (AA in the 32-bit format listed previously). For example, the following code, found in the bitmap_from_scratch_transparency.....

Học Actionscript 3.0 - p 27

tailieu.vn

Because we went the simple route of using a sprite for our interactive element (rather than building a multistate button with the SimpleButton class, as seen in the applied example at the end of Chapter 8), we need to set the buttonMode property of the sprite to true in line 15. This won’t create the up, over, and down states...

Học Actionscript 3.0 - p 28

tailieu.vn

This class uses a 4 × 5 matrix to transform red, green, blue, and alpha values of the image, and can be used to create advanced hue, saturation, and contrast changes, among other effects. The first four columns are the multipliers for red, green, blue, and alpha values of the source (s), and the fifth column is the offset value...

Học Actionscript 3.0 - p 29

tailieu.vn

Built atop Flash Player’s new text engine, TLF was officially released both as part of the Flash Professional CS5 interface and as a set of ActionScript 3.0 classes, and offers Flash Platform users unprecedented typographic control.. 261 IN THIS CHAPTER Creating Text Fields Setting Text Field Attributes Selecting Text Formatting Text Formatting with. Setting Text Field Characteristics. How you set...

Học Actionscript 3.0 - p 30

tailieu.vn

Using the first line, the extra word, “new” will be red, bold, and underlined because that’s the format when the text was added. Let’s get to the code. Take a look at the setup first, and then we’ll discuss the application of the tab stops:. 2 txtFmt.font = "_sans";. 3 txtFmt.size = 10;. 4 txtFmt.leading = 4;. 8 txtFld.x =...

Học Actionscript 3.0 - p 31

tailieu.vn

The first topic of this sec- tion will give you a peak at what we’ll be covering in Chapter 13: loading exter- nal assets. You’ll learn how to load and apply external HTML and CSS files.. The second topic of this section will give a brief overview of the new Text Layout Framework that brings some advanced typographic support to...

Học Actionscript 3.0 - p 32

tailieu.vn

The last example of the chapter is the most advanced and demonstrates one of TLF’s most powerful features: the ability to flow text across multiple containers. This is fur- ther demonstrated with selectable linked text and the ability to scroll within a field while selecting text—just like you can in a text editor.. One of the first things you’re likely...

Học Actionscript 3.0 - p 33

tailieu.vn

Once you’ve provided a linkage class name, you can create an instance of the sound the same way you instantiate a movie clip:. Thereafter, you can manage the instance of this sound by referring to the vari- able snd. All play, pause, stop, and transform operations are identical, regardless of the sound source.. Using internal sounds, creating an instance of...

Học Actionscript 3.0 - p 34

tailieu.vn

Now let’s apply what we’ve learned to our ongoing player example. The fol- lowing code can be found in the player_transform.fla source file, and demon- strates both volume and pan by using mouse coordinates. Figure 11-2 shows how the mouse will affect the sound transformation. Moving the mouse left and right pans the sound left and right. Figure 11-2. How...

Học Actionscript 3.0 - p 35

tailieu.vn

The Waveform class. The first dozen or so lines of the Waveform class will be familiar to you if you’ve been reading this book linearly. Line 1 declares the class’s package path as this class is part of the learningactionscript3 code library developed throughout this book. As dis- cussed extensively in Chapter 6, this is important for things like being...