Presentation is loading. Please wait.

Presentation is loading. Please wait.

More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg.

Similar presentations


Presentation on theme: "More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg."— Presentation transcript:

1 More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg

2 Shape tweening You can tween more than one shape on a layer, but sometimes you get weird results. Example – stem and top of mushroom are separate objects. Using tweening, make it look like the mushroom is growing. On the second keyframe, the top is moved up. The bottom is deleted and replaced by a longer stem.

3 ActionScript Syntax very much like C and C++ Like Lingo, much of the programming environment is inherently object-oriented. You can make graphic objects and convert them to symbols –Graphic –Buttons –Movie clips Then you make instances of symbols. So the symbols in the library are like classes.

4 Symbols Graphic symbols have their own timelines, but you have to have at least as many frames on the main timeline as on the graphic symbol’s timeline. Buttons have an independent timeline with up, down, over, and hit states. –You can animate the states with embedded movie clips if you want. –You can add sound to a state. Movie clips have an independent timeline. You can embed movie clips in movie clips. –E.g., a car driving on stage. The wheels can be an embedded movie clip.

5 Movie Clips and ActionScript You can give an instance name only to a movie clip. If a movie clip has a name, you can refer to it in ActionScript and do things with it dynamically. To add properties to a movie clip you can –Make the movie clip part of a class. –Add a property dynamically by assigning a value (Isn’t that great?!!) For example, KC.v = 10 adds an “instance variable” to hold the value of a card. KC is a movie clip. Nowhere was this instance variable declared. It is just created dynamically.

6 Declaring variables You don’t have to declare variables and their types in ActionScript, but you can if you want to. For example var value:Number = 10; Var Array: deck = new Array(); The advantages to declaring variables are –Type checking is done by the system, to help prevent your making mistakes –Prompts come up telling you want properties or functions are related to a variable. To get hints for movie clips, you have to add _mc to the variable name.

7 Action Pane and Script Pane You can see Global Functions and functions that you can use with movie clips in the Actions pane. You can doubleclick on a function name and it gets inserted into the script. You can also type things in yourself.

8 Object-Oriented Use a text editor to type a class definition into a text file, with suffix.as The text file should have the same name as the class and be in the same folder as the.fla program. Class Dog { var name: String; var weight: Number var bark: String; function Dog(name:String, weight: Number, bark: String) { this.name = name; this.weight = weight; this.bark = new Sound(); this.bark.attach(bark); }

9 Where do you put the code? First frame of action layer. On a button or movie clip. Etc.


Download ppt "More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg."

Similar presentations


Ads by Google