« Home « Chủ đề thủ thuật actionscript

Chủ đề : thủ thuật actionscript


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

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...

Học Actionscript 3.0 - p 36

tailieu.vn

19 public function RecordMicrophone. When the public startRecording() method is called from a button we’ll create later, a new byte array is created to hold the new recording. Lines 33 and 34 add a SAMPLE_DATA event listener to the mic to prepare it for capturing input. The getMicData() method in lines 38 through 40 is the aforementioned lis- tener method...

Học Actionscript 3.0 - p 37

tailieu.vn

If you’re not content with a preset, or if you have additional needs (such as resizing the source), you can click on the Settings button to customize the settings. (You can even save your customizations as a preset of your own.) Figure 12-4 shows the Settings interface. The upper left quadrant allows you to see various sizes of the source...

Học Actionscript 3.0 - p 38

tailieu.vn

This broadens the reach of the title across cul- tures and supports a wider audience with accessibility needs. If that’s not the case (such as when switching captions from one language to another at any moment), it adds the new text to the existing caption. 18 capsLangBtn.x = vid.x + vid.width + 20;. 19 capsLangBtn.y = vid.y + vid.height;. Lines...

Học Actionscript 3.0 - p 39

tailieu.vn

Part V homes in on two of the possible input and output methods used for transferring data and assets in the Flash world. Similar to the text-loading example, the chapter takes a close look at best practices for loading external SWF and image formats. In addition to the creation of XML docu- ments in their own right, the chapter discusses...

Học Actionscript 3.0 - p 40

tailieu.vn

Because the example makes no further use of the CustomLoader class, all its listeners are removed.. 1 import com.learningactionscript3.loading.CustomLoader;. 6 swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, 7 onComplete, 8 false, 0, true);. 10 evt.target.removeEventListener(Event.COMPLETE, onComplete);. 11 evt.target.loader.removeListeners();. 12 trace(evt.target);. 13 trace(evt.target.content);. 14 trace(evt.target.loader);. Like the previous JPG loading example, this script also loads the JPG directly to the display list in the last instruction of...

Học Actionscript 3.0 - p 41

tailieu.vn

We’ve set the maximum to 50, and the default to 0, and we’re incrementing the minimum by 1 every enter frame. For this discussion, we’ll reference the Loader class, but the ideas in this section apply equally to the CustomLoader class.. The key to communicating between a parent SWF created with ActionScript 3.0 and a loaded SWF created with ActionScript...