CISC 110 Day 5 OOP Part 2. 2 Outline The Display List Display List Classes Adding and Removing Objects Adding Symbol Instances Managing Object Depths.

Slides:



Advertisements
Similar presentations
INTRODUCTION TO ADOBE FLASH CS4
Advertisements

1What is the Stage. 2How do you open a panel in Flash
JustinMind: Dynamic Panels
AS3: Events & Listeners eventListeners in ActionScript 3.
Macromedia Director 8 Foundation Level Course. What is Director? Director is a challenging program for creating animation and multimedia productions for.
Macromedia Flash MX 2004 – Design Professional and Interactivity WORKING WITH SYMBOLS.
1 Flash Actionscript Event Handling. 2 Event Handling Right now we know all about variables lets go back to our text input/output example: Suppose we.
Macromedia Flash 5 Intermediate Level Course. Animation Basics Playhead In-Between Frames Keyframe Current Frame Number Framerate Current Time Frames.
Work with symbols and instances Work with Libraries Create buttons Assign actions to buttons Unit Lessons.
1 Flash Actionscript Adding Interactive Actions Variables.
Introduction to Macromedia Flash 8
1 Flash Actionscript Actionscript and Objects. 2 Actionscript and Objects ActionScript is what's known as an object-oriented programming language. Object-oriented.
Creating Flash Buttons Button Making Rollover Effects Enlarging the Clickable Area Giving Buttons Behaviors Behavior Options.
1 Flash and Animation Presented by : Behzad Sajed Khosrowshahi.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Creating Animation Pertemuan Matakuliah: L0182 / Web & Animation Design Tahun: 2008.
MovieClips & Properties Flash ActionScript Introduction to Thomas Lövgren
© 2011 Delmar, Cengage Learning Chapter 8 Building Complex Animations.
Chapter 17 Putting It All Together. Viewing the Preloader To view the preloader, 1.CTRL-Enter to test the movie. 2.View > Simulate Download.
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 15 Video. Importing Video Into Flash Once you import video into Flash MX 2004, you can control it using behaviors and very basic ActionScript,
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.
Lehigh University Introduction to Flash MX Sharmeen Mecklai.
Adobe Flash Professional CS5 Provides a comprehensive authoring environment for creating digital animation and interactive Web sites. Used to create engaging.
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 9 Introduction to ActionScript 3.0.
Interface & navigation (How to build a simple presentation interface) Flash ActionScript Introduction to Thomas Lövgren
© 2012 Adobe Systems Incorporated. All Rights Reserved. Copyright 2012 Adobe Systems Incorporated. All rights reserved. ® INTRODUCTION TO FLASH ANIMATION.
Copyright © 2003 Pearson Education, Inc. Chapter 3, Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
® Copyright 2008 Adobe Systems Incorporated. All rights reserved. ® ® 1 INTRODUCTION TO ADOBE FLASH CS3.
® Copyright 2010 Adobe Systems Incorporated. All rights reserved. ® ® 1 INTRODUCTION TO ADOBE FLASH PROFESSIONAL CS5.
Working with Symbols and Interactivity
Creating a Logo – Lesson 3 1 Creating a Logo Lesson 3.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
Getting a handle on ActionScript A basic primer for non-programmers.
SM1205 Interactivity Topic 06: Iteration and Multiple Objects Spring 2012SCM-CityU1.
XP Tutorial 4 Special Animations. XP New Perspectives on Macromedia Flash MX Special Layers for Animation Animation Using a Motion Guide Layer.
Tutorial 7 Planning and Creating a Flash Web Site.
Creating Buttons – Lesson 71 Creating Buttons Lesson 7.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
CSC 361/661 Digital Media Spring 2010 Professor Burg.
2006 Adobe Systems Incorporated. All Rights Reserved. 1 INTRODUCTION TO ADOBE FLASH CS3.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
ActionScript: Addressing Display Objects, Duplicating MovieClips, Attaching MovieClips Dynamically MMP 220 Multimedia Programming This material was prepared.
Flash CS 5 Interface BY NSCHEWCZYK | ©2012. MENU BAR A bar at the top of the window. It lists menu options including: File, Edit, View, Insert, Modify,
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Macromedia Flash Design Professional And Interactivity WORKING WITH SYMBOLS.
© 2011 Delmar, Cengage Learning Chapter 10 Using ActionScript to Enhance User Experience.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
FLASH!!!!!!!!!!!!!!!!!!!!!!!!! A TUTORIAL BY BRITTANY HESS AND MARGARET DENTON.
CIS 205—Web Design & Development Flash Chapter 3 Appendix on Using Buttons.
© 2011 Delmar, Cengage Learning Chapter 11 Adding Sound and Video.
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.
CISC 110 Day 7 “The Outliers, Part1” hitTest(), Text Input, Frame and Timer Loops, Publishing Flash Content.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
Macromedia Flash MX Design Professional And Interactivity WORKING WITH SYMBOLS.
Creating cast members  Using tool palette window that can be selected from window menu.  The following objects can be created: Push buttons, Radio buttons,
Creating Complex Animations
Actionscript 3 Graphics Programming
Actionscript Session 2 Roy McElmurry.
INTRODUCTION TO ADOBE FLASH CS4
Animate Some more advanced concepts
Exercise : Animated Navigation Structure in Animate (= Flash)
Exercise : Animated Navigation Structure in Flash
Presentation transcript:

CISC 110 Day 5 OOP Part 2

2 Outline The Display List Display List Classes Adding and Removing Objects Adding Symbol Instances Managing Object Depths

The Display List 3 Stage (DisplayObjectContainer) MainTimeline (DisplayObjectContainer) Shape (DisplayObject) MovieClip (DisplayObjectContainer) TextField (DisplayObject) Bitmap (DisplayObject)

Display List Classes 4 DisplayObject ShapeBitmapVideoInteractive ObjectMorphShapeStaticText DisplayObjectContainerSimpleButton TextField StageLoaderSprite MovieClip

Display List Classes DisplayObject: Anything that can exist in the display list is a display object. More specialized classes are derived from DisplayObject. Shape: Rectangle, ellipse, line, etc., created with drawing tools or at runtime. Bitmap: This is an ActionScript bitmap created at runtime using the BitmapData class. Note that a standard JPG import does not create this kind of bitmap, but rather creates a Shape. After creating a bitmap with this class, however, you can place an imported JPG into it for display. 5

Display List Classes Video: This is a video display object, the minimum required to play a video, rather than a video component. InteractiveObject: This class includes any display object the user can interact with using the mouse or keyboard. It is not used directly to manipulate the display list. Instead, you work with its descendents. MorphShape and StaticText: These classes represent a shape tween and a static text element, respectively, neither of which are controllable directly via ActionScript. 6

Display List Classes SimpleButton: This class is used to create a button that’s functionally equivalent to the buttons you’ve created in the authoring interface. However, you can create buttons on the fly by using other display objects for their up, over, down, and hit states. TextField: This class includes dynamic and input text elements, controllable with ActionScript. DisplayObjectContainer: This class is similar to DisplayObject in that it refers to multiple display object types. The difference, however, is that this object can contain children (other display objects). 7

Display List Classes Stage: Remember that the stage itself is part of the display list. Any interactive object can reference the stage, which itself is a display object container. Sprite: A sprite is simply a movie clip without a timeline. Many ActionScript manipulations typically performed using movie clips only require one frame of the created movie clip’s timeline. So, the size and administrative overhead of the timeline is unnecessary. Loader: This class is used to load external assets destined for the display list, including bitmaps and other SWFs. 8

Display the Display List function showChildren( dispObj:DisplayObject ): void {for( var i:int = 0; i < dispObj.numChildren; i++ ) {var obj:DisplayObject = dispObj.getChildAt( i ); if( obj is DisplayObjectContainer ) {trace( obj.name, obj ); showChildren( obj ); } else { trace( obj ); } 9

Result of Function Call: showChildren(stage) root1 [object MainTimeline] largeContainer [object MovieClip] [object Shape] smallContainer [object MovieClip] [object Shape] child2 [object MovieClip] [object Shape] [object StaticText] child0 [object MovieClip] [object Shape] [object StaticText] child1 [object MovieClip] [object Shape] [object StaticText] 10

Add Objects to the Display List // Create objects (for a simple example, empty objects) var mc: MovieClip = new MovieClip( ); var sh: Shape = new Shape( ); // Add shape to the stage addChild( sh ); // Add movie clip to stage and shape to movie clip addChild( mc ); mc.addChild( sh ); 11

Add Symbol Instances to the Display List 1.Start with a symbol that you’ve created that is in your library, e.g. a MovieClip called mcOrange. 2.In the library panel, click the Symbol Properties button (looks like an “i” at the bottom of the library) or choose Linkage from the library menu. 3.In the resulting dialog, click to enable the Export for ActionScript option and add a name to the Class field, e.g. Orange. 4.Now you can create an instance of your custom class: var snack: Orange = new Orange( ); 12

addChildAt( ) Method Purpose: To add a child at a specific position in the display list Example: Add new orange to start of list with each mouse click var inc: int = 0; stage.addEventListener( MouseEvent.CLICK, onClick ); function onClick( evt: MouseEvent ): void { var snack: Orange = new Orange( ); snack.x = snack.y = inc * 10; addChildAt( snack, 0 ); inc ++; } 13

Remove Objects from the Display List To remove a specific object from the display list, you can use the removeChild( ) method. Example: Remove the snack object removeChild( snack ); To remove a display object at a specific level, you can use the removeChildAt( ) method. Example: Remove the display object at level 0 removeChildAt( 0 ); 14

Remove Objects from the Display List Example: Add 20 oranges. Then remove one with each mouse click. for( var inc: int = 0; inc < 20; inc++ ) { var snack: Orange = new Orange( ); snack.x = snack.y = inc * 10; addChild( snack ); } stage.addEventListener( MouseEvent.CLICK, onClick); function onClick( evt: MouseEvent ): void {removeChildAt( 0 ); } 15

Remove Objects from Memory Example: Add an orange, then remove it with a mouse click. var snack: Orange = new Orange( ); snack.x = snack.y = 100; addChild( snack ); stage.addEventListener( MouseEvent.CLICK, onClick); function onClick( evt: MouseEvent ): void {removeChild( snack ); // Remove from display list snack = null; // Remove from memory } 16

Position Groups of Objects var orangeCrate: MovieClip = new MovieClip( ); var orange1: Orange = new Orange( ); var orange2: Orange = new Orange( ); orange2.x = orange1.x + orange1.width + 10; addChild( orangeCrate ); orangeCrate.addChild( orange1 ); orangeCrate.addChild( orange2 ); orangeCrate.x = 150; orangeCrate.y = 200; 17

Manage Object Depths 18 // Assume we have already created a Pepper class var fruit: Orange = new Orange( ); var veggie: Pepper = new Pepper( ); addChild( fruit ); addChild( veggie ); // Swap the depths of fruit & veggie swapChildren( fruit, veggie ); trace( “fruit depth: ” + getChildIndex( fruit ) ); trace( “veggie depth: ” + getChildIndex( veggie ) );

Other Depth-Management Methods getChildAt( ): Returns a DisplayObject instance at a specified index getChildIndex( ): Returns the index position of the specified Child DisplayObject setChildIndex( ): Changes the index position of the specified Child DisplayObject swapChildrenAt( ): Swaps the positions of two child DisplayObjects at specified index positions 19