AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 2 "The games of a.

Slides:



Advertisements
Similar presentations
1What is the Stage. 2How do you open a panel in Flash
Advertisements

© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 18 – Macromedia Flash MX 2004: Building an Interactive Game Outline 18.1 Introduction 18.2 Object-Oriented.
1 Flash Actionscript Animation. 2 Introduction to Sprites We will now look at implementing Sprites in Flash. We should know enough after this to create.
Macromedia Flash MX A Brief Tutorial for “Programming Usable Interfaces” Andrew Ko.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Roentgen photo effect. This detailed, thoroughly explained lesson will show you how to create very attractive roentgen photo effect. You can use this.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
MovieClips & Properties Flash ActionScript Introduction to Thomas Lövgren
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Chapter 3 Working with Symbols and Interactivity.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
BUILDING RICH MEDIA ELEMENTS. Design Decisions Based on Design Specification  Following the design specification will ensure that the application is.
Exercise : Animated Navigation Structure in Flash 1.Develop Answers to “What did you learn in ITI program?” “What do you have to offer?” “What are your.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 3 "The games of a people reveal.
Flash II MIS439 Eva Tao March 19, 2007 Source:
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Button library Create a button Learn.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Buttons library Edit a button instance.
My First ACCESSIBLE Flash Movie. Course notes Detailed course notes, a printable copy of my slides, and all the samples shown today can be downloaded.
Chapter 11 Adding Sound and Video. Chapter 11 Lessons 1.Work with sound 2.Specify synchronization options 3.Modify sounds 4.Use ActionScript with sound.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Symbols and Interactivity.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 8 "The games of a people reveal.
Creating a Logo – Lesson 3 1 Creating a Logo Lesson 3.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 3 "The games of a.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 8 "The games of a.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 3 "The games of a.
Creating Buttons – Lesson 71 Creating Buttons Lesson 7.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script "The games of a people reveal.
1. Press the New Layer Button 3. Double click names to re-name Ball & Shadow layers 2. Click to change to 12 fps Step 1.
2006 Adobe Systems Incorporated. All Rights Reserved. 1 INTRODUCTION TO ADOBE FLASH CS3.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Sound in Action Script "The games of a people reveal.
Game Maker Terminology
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 6 "The games of a people reveal.
© Anselm Spoerri Lecture 10 – Related: Part 1 Flash –Build Flash Website with Animated Navigation Structure –Decide on Overall Navigation Layout, Import.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 3 "The games of a people reveal.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
Tutorial 3 Creating Animations. XP Objectives Learn the different elements of animation Create frames and layers Organize frames and layers using the.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 6 "The games of a.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Action Script 12 "The games of a people.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
CIS 205—Web Design & Development Flash Chapter 3 Appendix on Using Buttons.
Dr.Al-Mothana Gasaymeh. Buttons تسخدم لخلق تفاعل بين المستخدم و البرنامج دائما ضع الازرار في طبقة مستقلة.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
© 2011 Delmar, Cengage Learning Chapter 11 Adding Sound and Video.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 12 "The games of.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script "The games of a people.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 11 "The games of a people reveal.
 Movieclip symbols are reusable pieces of flash animation  consisting usually of one or more graphic/button symbols  thus they are flash movies within.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
 Motion Tween allow us to move a shape on the stage from one place to another.  In order to use motion tween, the shape to be moved must be converted.
Tutorial 3 Creating Animations.
Scratch for Interactivity
Adding Buttons, Actions, and Sounds
Flash Interface, Commands and Functions
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
DREAMWEAVER MX 2004 Chapter 7 Working with Layers
Working with Symbols and Interactivity
Exercise : Animated Navigation Structure in Animate (= Flash)
Exercise : Animated Navigation Structure in Flash
Presentation transcript:

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 2 "The games of a people reveal a great deal about them.“ Marshall McLuhan

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip playback control movie_clip_control.fla Movie clips contain timeline with layers and most of elements of main Flash movie By default the movie clip will loop frames in its timeline in the flash movie View the example “movie_clip_control.fla” in the Pickup folder Notice myMovieClip symbol in the library and two instances of this movie clip on the stage: Left instance has no name ( properties panel > instance name is empty) Right instance is named “myMovieClip” Test movie

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip playback control movie_clip_control.fla The second instance “myMovieClip” is controlled by Action Script commands applied for the buttons Select Play button on the stage and review the following Action Script command in the Actions window Play button plays myMovieClip timeline on (press) { _root.myMovieClip.play(); } _root addresses the main timeline of the Flash movie _root.myMovieClip addresses myMovieclip on the main timeline.play() plays the myMovieclip timeline

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip playback control Select Stop button on the stage and review the following Action Script command in the Actions window Stop button stops myMovieClip timeline on (press) { _root.myMovieClip.stop(); }.stop() stops myMovieClip timeline at the current frame

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip playback control Select First Frame button on the stage and review the following Action Script command in the Actions window First Frame button returns myMovieClip to the first frame of its timeline and stops on (press) { _root.myMovieClip.gotoAndStop(1); }. gotoAndStop(1) returns myMovieclip to the first frame (1) and stops

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip playback control Select Next Frame button on the stage and review the following Action Script command in the Actions window Next Frame button moves myMovieClip one frame forward on (press) { _root.myMovieClip.nextFrame(); }. nextFrame() moves myMovieclip forward one frame

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip playback control Select Previous Frame button on the stage and review the following Action Script command in the Actions window Previous Frame button moves myMovieClip one frame backward on (press) { _root.myMovieClip.prevFrame(); }. prevFrame() moves myMovieclip backward one frame

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 The Cartesian coordinate system Given a fixed point of reference or ORIGIN an axis of direction PLUS (+) or MINUS (-), and a UNIT MEASURE, the Cartesian Coordinate system assigns to the screen a HORIZONTAL and VERTICAL AXIS.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 The Flash coordinate system ORIGIN ( 0, 0) top left corner Positive Y is down, negative Y is up

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 The Flash coordinate system A screen location can be specified by X and Y coordinate pairs.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties a short-list of visible read/write properties _xHorizontal position of a movie clip, in pixels. Measured from the left side of the clip's _parent's stage to the registration point of the movie clip. Zero, the left side of the stage. _yVertical position, in pixels. Zero, the top of the stage. _xscaleHorizontal scaling of an instance relative to the original symbol placed on stage. 100% of original horizonal scale. _yscale Vertical scaling of an instance relative to the original symbol. 100% of original vertical scale.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties _widthThe width, in pixels, of the space occupied by the movie clip. Completely relative, that is, once changed, there is no stored value representing the original width of the element _heightThe height, in pixels, of the space occupied by the movie clip. Completely open _alphaTransparency percentage. 0 being completely transparent; 100 being completely opaque _rotationDegrees of rotation. note: Yes, you can set _rotation to 360; _rotation can be set to any number, but one complete revolution looks the same as two, or three, or seventeen to 0 to being the original rotation of the instance.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties _visibleTrue and False are Boolean values. When a clip's _visible property is set to false, buttons inside the clip will no longer detect events. 1 or 0; also, true or false 0 or false being invisible, 1 or true being visible.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties control mc_properties.fla Action Script can control external properties of the movie clip Open “mc_properties.fla” file from the Pickup folder and save it on your flash drive

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties control mc_properties.fla Note the movie clip name is “fox” Check the movie size: Modify > Document > dimentions width=550 height = 400 Select buttons on the stage and study the action script commands in the Actions window sets horizontal location of the fox to 200 on (press) { _root.fox._x = 200; }

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties control mc_properties.fla sets horizontal location of the fox to 275 middle of the stage ( 550 / 2= 275) on (press) { _root.fox._x = 275; } sets horizontal location of the fox to 350 on (press) { _root.fox._x = 350; }

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties control mc_properties.fla sets angle of rotation of the fox to 0 on (press) { _root.fox._rotation = 0; } sets angle of rotation of the fox to 30 degrees clockwise on (press) { _root.fox._rotation = 30; }

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Movie clip properties control mc_properties.fla sets proportional scale of fox to 50% on (press) { _root.fox._xscale = 50; _root.fox._yscale = 50; } sets proportional scale of fox to 100% sets proportional scale of fox to 150%

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips simple_drag.fla Open “simple_drag.fla” file from the Pickup folder Note the movie clip instance name is “circle” Study the 1 FRAME script: startDrag("circle",true); “circle”name of the movie clip truelocks the object center to the cursor

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips drag_button.fla Open “drag_button.fla” file from the Pickup folder Double click on the “circle” movie clip in the library and study the following script applied to the invisible button inside the “circle” movie clip in the button layer: on (press) { startDrag("",false); } on (release) { stopDrag(); } Executes the startDrag command when the user presses button down, and stopDrag command when the user lifts up the button

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips drag_button.fla on (press) { startDrag("",false); } “ “ Empty quotes addresses the current movie clip. Because the button is inside the “circle” movie clip, that particular movie clip can be dragged. false Will maintain the original distance between the cursor and movie clip instead of locking it to the center. This makes it appear as if cursor has grabbed a part of the circle and is dragging the circle by that point. stopDrag Stops dragging. Only one movie clip can be dragged at the time, so no parameters.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips drag_function.fla Open “drag_function.fla” file from the Pickup folder Double click on the “circle” movie clip in the library and study the following script applied to the invisible button inside the “circle” movie clip in the button layer: on (press) { drag = true; } on (release) { drag = false; } dragvariable used to determine whether or not the movie clip should follow the cursor. true – drag (button pressed), false – no drag (button lifted)

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips drag_function.fla Go back to the main timeline by clicking on the Scene1 button:

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips drag_function.fla Select the movie clip “circle” on the stage and study the following script in the actions window: onClipEvent (enterFrame) { if (drag) { this._x = _root._xmouse; this._y = _root._ymouse; } This script sets _x and _y properties of the movie clip to _xmouse and _ymouse cursor position in the main timeline

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips multiple_MC.fla Open “multiple_MC.fla” file from the Pickup folder Select dummy “actions” movie clip on the stage and study the following script applied: onClipEvent (load) { // create 10 movie clips for(i=0;i<10;i++) { _root.attachMovie("sample","sample"+i,i);

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips multiple_MC.fla _root.attachMovie("sample","sample"+i,i); “sample”linckage id name of the movie clip “sample"+Iname of the instance of movie clip on the stage ilevel of the movie clip instance. Describes an order in which movie clips are drawn First movie clip drawn at level 0, second at level 1, third at level 2, and so on. Flash won’t let two movie clips be created at the same level.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips multiple_MC.fla // set the location of clips _root["sample"+i]._x = i*50+50; _root["sample"+i]._y = 100; } _root["sample"+i]._y = 100; The vertical location of all movie clips set to 100 _root["sample"+i]._x = i*50+50; The horizontal locations are different starting with 50 and ending at 500

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Dragging and Dropping Movie clips multiple_MC.fla onClipEvent (enterFrame) { // loop through and rotate each movie clip for(i=0;i<10;i++) { _root["sample"+i]._rotation += 5; } The code loops through all movie clips and rotates each one by 5 degrees. The result is all 10 movie clips are rotation on the stage.

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Collision Detection collision.fla The code detecting whether two objects collide, or whether the cursor location collides with an object Open “collision.fla” file from the Pickup folder Note “target” and “bullet” movie clips Select dummy “actions” movie clip on the stage and study the following script applied:

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Collision Detection collision.fla onClipEvent (enterFrame) { // see if the bullet hit the target if (_root["target"].hitTest(_root["bullet"])) { // collision, so target grows _root["target"]._xscale += 5; _root["target"]._yscale += 5; // bullet resets _root["bullet"]._x = 350; } else { // no collision, continue to move bullet _root["bullet"]._x -= 5; }

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Collision Detection collision.fla _root [ "target“ ]. hitTest ( _root [ "bullet“ ]) hitTest function to determine if two objects collide or an object is covering a certain point on the screen _root [ "target“ ] “target” movie clip _root [ "bullet“ ] “bullet” movie clip

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Collision Detection collision.fla if ( _root [ "target“ ]. hitTest ( _root [ "bullet“ ]) ) If bullet hits the target this condition is TRUE the target scale increased by 5% _root["target"]._xscale += 5; _root["target"]._yscale += 5; And bullet horizontal position is set to 350 _root [ "bullet“ ]. _x = 350;

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Collision Detection collision.fla else { _root["bullet"]._x -= 5; } If there is no collision, condition is FALSE, ELSE statement is executed The code moves bullet -5 pixels at a time to the left towards the target

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Assignment - Confinement 1.Create an interactive animation using Action Script in Flash with a small bouncing object (box) inside the larger object (cube). Cube and box are just examples here – create your own objects to deliver the idea of confinement. The concept of this assignment revolves around the idea of being constrained in a box. The box is a metaphor for the physical, social, political or psychological constraints that we and/or others place upon us. The box also represents a sense of place in the realm of the virtual as well as in our conscience. InterPlay: Loose Minds in a Box SIGGRAPH2005 Use: Variables &&/|| Functions &&/|| Collision detection &&/|| movie clip properties

AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Assignment - Confinement Optional for extra grade: 2,3,4. Add more bouncing boxes. Use different speeds. Change size of the boxes each time it bounces from the cube. If the box becomes larger then the cube, create an animation to brake the cube.