Flash ActionScript Introduction to Scope & Levels duplicateMovieClip & attachMovieClip.

Slides:



Advertisements
Similar presentations
PHP functions What are Functions? A function structure:
Advertisements

Flash: Controlling Sound Presentation by Mindy McAdams.
Local Variables and Scope Benjamin Fein. Variable Scope A variable’s scope consists of all code blocks in which it is visible. A variable is considered.
Copyright © 2003 Pearson Education, Inc. Chapter 7 – Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
 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.
Chapter 5 C Functions The best way to develop and maintain a large program is to divide it into several smaller program modules, each of which is more.
© Anselm Spoerri Lecture 11 Flash –Build Flash Website with Animated Navigation Structure –Decide on Overall Navigation Layout, Import Images & Organize.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
FLASH Presenters: Tin Hoang Andrew Mcdonald Mehran Panahi Akhavan Matthew Tang.
1 Flash Actionscript Adding Interactive Actions Variables.
B.Sc. Multimedia ComputingMultimedia Authoring Introduction to ActionScript.
Utah State Topics Movie Clips Using actionScript to control “other” timelines  Instance names  _root., _parent. (object hierarchy and dot syntax)
1 Flash Actionscript Adding Interactive Actions. 2 ActionScript 3.0 ActionScript is the language you use to add interactivity to Flash applications, whether.
Introduction to Programming with Java, for Beginners Scope.
“But I don't want to be a “programmer!” ActionScript for journalists Presentation by Mindy McAdams Flashjournalism.com.
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.
Animations Flash ActionScript Introduction to Thomas Lövgren
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.
Interface & navigation (How to build a simple presentation interface) Flash ActionScript Introduction to Thomas Lövgren
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Getting a handle on ActionScript A basic primer for non-programmers.
Introduction to Programming Using C Modularity. 2 Contents Modularity Functions Preprocessor Comments Global variables.
More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg.
 2007 Pearson Education, Inc. All rights reserved C Functions -Continue…-
INTRO TO ACTIONSCRIPT 3.0 The Bad News: Learning ActionScript is as Much Fun as Being Torn Apart By a Pack of Crazed Wombats. (And I say that in a loving.
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.
Chapter 8 Scope of variables Name reuse. Scope The region of program code where it is legal to reference (use) a variable The scope of a variable depends.
ActionScript: Addressing Display Objects, Duplicating MovieClips, Attaching MovieClips Dynamically MMP 220 Multimedia Programming This material was prepared.
© Anselm Spoerri Lecture 10 – Related: Part 1 Flash –Build Flash Website with Animated Navigation Structure –Decide on Overall Navigation Layout, Import.
 2007 Pearson Education, Inc. All rights reserved Random Number Generation  rand function – Load – Returns "random" number between
Variables, Scope, Images, Sound IM ActionScript.
Dale Roberts CSCI 230 Functions Scope, Parameter Passing, Storage Specifiers Department of Computer and Information Science, School of Science, IUPUI Dale.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
Functions in C CSE 2451 Rong Shi. Functions Why use functions? – Reusability Same operation, different data – Abstraction Only need to know how to call.
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
KIC/Computer Programming & Problem Solving 1.  Header Files  Storage Classes  Scope Rules  Recursion Outline KIC/Computer Programming & Problem Solving.
© 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.
CIS 205—Web Design & Development Flash Chapter 3 Appendix on Using Buttons.
INTRO TO ACTIONSCRIPT 3.0 The Bad News: Learning ActionScript is as Much Fun as Being Torn Apart By a Pack of Crazed Wombats. (And I say that in a loving.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
+ Storage Classes and Linkage. + Introduction Scope describe the region or regions of a program that can access and identifier Variables can be shared.
Intro to ActionScript CIS 126 Greg Shorts. What Is ActionScript? ActionScript is the scripting language Flash uses to control its movies and the objects.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
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.
1 This week Basics of functions Stack frames Stack vs. Heap (brief intro) Calling conventions Storage classes vs. scope Library functions Overloading.
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.
Prof. Anselm SpoerriMultimedia Production Rutgers Lecture 11 Flash –Build Flash Website with Animated Navigation Structure –Decide on Overall.
var variableName:datatype;
4. Java language basics: Function
C Functions -Continue…-.
Unit Lessons Work with actions
Programming the Web using XHTML and JavaScript
Chapter 5 - Functions Outline 5.1 Introduction
Introduction to JavaScript
Chapter 5 - Functions Outline 5.1 Introduction
Scope, Parameter Passing, Storage Specifiers
Flash & ActionScript Syntax is similar to JavaScript
Tonga Institute of Higher Education
Tonga Institute of Higher Education
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Web programming and advanced development techniques
Introduction to JavaScript
MovieCLip Instances & ActionScript
Exercise : Animated Navigation Structure in Flash
Presentation transcript:

Flash ActionScript Introduction to Scope & Levels duplicateMovieClip & attachMovieClip

Variables & Scope A variable's scope refers to the area in which the variable is known (defined) and can be referenced A variable's scope refers to the area in which the variable is known (defined) and can be referenced Global variables and functions are visible to every timeline and scope in your document. Therefore, a global variable is defined in all areas of your code Global variables and functions are visible to every timeline and scope in your document. Therefore, a global variable is defined in all areas of your code Timeline variables are available to any script on that timeline Timeline variables are available to any script on that timeline Local variables are available within the function body in which they are declared (delineated by curly braces) Local variables are available within the function body in which they are declared (delineated by curly braces)

Scope & Levels Main timeline: _level0 Main timeline: _level0 Each _levelX has it’s own timeline Each _levelX has it’s own timeline _root: The highest level (main stage) _root: The highest level (main stage) _parent: Up one level _parent: Up one level this: Current timeline this: Current timeline Tip! Large projects - many.swf files Tip! Large projects - many.swf files Loading of.swf files through: Loading of.swf files through:loadMovie() Loading to level 1: Loading to level 1: loadMovieNum("loadMovie1.swf", 1); Ex

Duplicate & levels Create a copy/copies of a movieClip Create a copy/copies of a movieClip Each movieClip copy need an unique level/depth (increase the level) Each movieClip copy need an unique level/depth (increase the level) Two general methods: duplicateMovieClip: MovieClip on stage duplicateMovieClip: MovieClip on stage duplicateMovieClip("newclip"+level, level); attachMovie: MovieClip from library (Linkage) attachMovie: MovieClip from library (Linkage) attachMovie("my_mc", "newclip"+level, level); Ex

duplicateMovieClip duplicateMovieClip: MovieClip on stage duplicateMovieClip: MovieClip on stage //duplicate first movieClip duplicateMovieClip("first_mc", "newclip" + level, level); //put new clips in position _root["newclip" + level]._x += xSpace; _root["newclip" + level]._y -= ySpace; //increase level level++; //increase the distance xSpace += 15; ySpace += 5; Ex

attachMovie attachMovie: MovieClip from library (Linkage) attachMovie: MovieClip from library (Linkage) //get the movieClip from library attachMovie("my_mc", "newclip"+level, level); //random position _root["newclip"+level]._x = random(470) + 50; //int(Math.random()* ); _root["newclip"+level]._y = random(250) + 50; //int(Math.random()* ); //increase level level++;//output clipName = "newclip" + level Ex

removeMovieClip A movieClip instance in a specific level/depth could be removed by the removeMovieClip function A movieClip instance in a specific level/depth could be removed by the removeMovieClip function _root["newclip"+ level].removeMovieClip(); Remove all/many movieClips by a loop Remove all/many movieClips by a loop for(i=0; i < length; i++){ _root.starMovie_mc["starText_mc" + i].removeMovieClip(this); } Ex