« Home « Chủ đề tài liệu ActionScript

Chủ đề : tài liệu ActionScript


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

Học Actionscript 3.0 - p 2

tailieu.vn

When ActionScript 3.0 was released, the interest in the language grew dra- matically. In the Flash community reactions ranged from excitement to uncertainty to fear, as the ActionScript 3.0 learning curve became apparent.. We hope this book will help ActionScript coders of all kinds—from curious to intimi dated, from eager to experienced—embrace the power and perfor- mance of ActionScript 3.0....

học actionscript 3.0 - p 3

tailieu.vn

It concludes with a review of core language fundamentals, most of which remain consistent across all versions of ActionScript. The material at the out- set of the book serves as an introduction to ActionScript for those new to the language, or as a refresher for those already familiar with it, and allows you to focus later on ActionScript 3.0–specific syntax.....

Học Actionscript 3.0 - p 4

tailieu.vn

Much discussion has been made over the pros and cons of procedural and object-oriented programming, and many who are new to ActionScript 3.0 have been led to believe that using OOP is the only way to program in ActionScript 3.0. Object-oriented programming is very powerful, and you’ll probably want to use it when you’re more comfortable with the language. Procedures,...

Học Actionscript 3.0 - p 5

tailieu.vn

19 IN THIS CHAPTER. ActionScript 3.0 is a complete rewrite of the language—so much so that ActionScript 3.0 doesn’t even share the same Flash Player code base as prior versions of ActionScript. The truth is that all versions of ActionScript to date have quite a bit in common. This is because ActionScript is based on a scripting language standard (called...

Học Actionscript 3.0 - p 6

tailieu.vn

Instead, they alter the original based on whatever is to the right of the equal sign. The first assigns a value to an expression. Both comparison and logical operators are discussed later in the “Conditionals” section of this chapter.. The as and is operators are discussed earlier in the “Casting” section of this chapter.. When used in the context of...

Học Actionscript 3.0 - p 7

tailieu.vn

Creating this arrangement is as simple as using an inner array as a value for one of the indices of the outer array. You can do this at the outset, or add it using push() —both of which are demonstrated here:. For instance, continuing the prior example to retrieve the first item in the array mdArray1 , you need only...

Học Actionscript 3.0 - p 8

tailieu.vn

Part II represents the largest section of the book, spanning Chapter 3 through Chapter 9. Chapter 3 is a discussion of properties, events, and methods—the items responsible for manipulating just about anything in Flash. Chapter 6 marks an important transition in the book. Chapter 6 discusses object-oriented programming and, while still introducing syntax in the timeline, the remaining chapters in...

Học Actionscript 3.0 - p 9

tailieu.vn

Once the functions are defined, all you have to do is add the listeners to the appropriate buttons.. 13 move_left_btn.addEventListener(MouseEvent.MOUSE_UP, onMoveLeft);. 14 move_right_btn.addEventListener(MouseEvent.MOUSE_UP, onMoveRight);. 15 move_up_btn.addEventListener(MouseEvent.MOUSE_UP, onMoveUp);. 16 move_down_btn.addEventListener(MouseEvent.MOUSE_UP, onMoveDown);. This simple process is then repeated for each of the buttons on stage. The resulting file wires up one or more buttons for each property, all of which manipulate the...

Học Actionscript 3.0 - p 10

tailieu.vn

There are three optional parameters that you can add to the end of the addEventListener() method. Here is the syntax of the method, which will look partly familiar. The first optional parameter, useCapture, allows you to handle the listener event before it reaches its target (if set to true) or once the event has reached its target (if set to...

Học Actionscript 3.0 - p 11

tailieu.vn

The second parameter is used by the function itself, and its value will ulti- mately indent each level of child objects, formatting the output to show the hierarchical relationships in the file. Note that the second parameter of the showChildren() function has a default value of 0, so you don’t have to pass anything into the function for this param-...

Học Actionscript 3.0 - p 12

tailieu.vn

If the data type of the par- ent is unknown to the ActionScript compiler, you will get an error similar to:. Previously discussed in Chapter 2, casting is particularly important when manipulating the display list and warrants another mention. Casting means you are explicitly tell- ing the ActionScript compiler the data type of the object—changing the compiler’s understanding of the...

Học Actionscript 3.0 - p 13

tailieu.vn

Line 1 of the following script is an event listener added to a button named stopBtn. 1 stopBtn.addEventListener(MouseEvent.CLICK, onStopClick, 2 false, 0, true);. All playback of the main timeline will cease when the user clicks the button.. Adding the following lines to the script will allow you to restart playback.. The new code is similar to the previous example, but...

Học Actionscript 3.0 - p 14

tailieu.vn

The remainder of the script is similar to the previous examples, creating three buttons that all access the same listener. Line 10 populates the nextSection variable using the name of the button that was clicked. Knowing that the target property can identify the button that was clicked, we can further query its name property to determine the name of the...

Học Actionscript 3.0 - p 15

tailieu.vn

Here is an example structure of the fictional Water class cited in the prior import statement. Note the path—up to, but not including, the class name—. in the package declaration. Forgetting to include this will result in a compiler error telling you that the package declaration of the class does not reflect the location of the file.. public function Water....

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