Arrays in Flash What is an Array: What is an Array: Array is a list of cells, each cell in the list has a number to identify it (index or position). هي

Slides:



Advertisements
Similar presentations
Event Handling in flash Event: is an instantaneous occurrence usually triggered by user. هو احداث تقع فورا وتطلق عادة باستخدام المستخدم Event: is an instantaneous.
Advertisements

Flash MovieClip Symbols Movieclip symbols are reusable pieces of flash animation هي قطع من حركات الفلاش يعاد استخدامها عدة مرات Movieclip symbols are reusable.
Flash: Controlling Sound Presentation by Mindy McAdams.
NumericStepper Component You can use the numeric stepper anywhere you want a user to select a numeric value. You can use the numeric stepper anywhere you.
© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
CIS 205—Web Design & Development Flash Chapter 3 Appendix B on Creating Animations.
 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.
Adding Interactivity to Flash Movies Using Buttons and ActionScript SPACE Lab
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.
Flash Workshop Flash Workshop :: Agenda  Introductions  Look at a few Flash Examples  Flash Web Sites  Flash Web Applications  Flash Games.
Work with symbols and instances Work with Libraries Create buttons Assign actions to buttons Unit Lessons.
1 Flash Actionscript Adding Interactive Actions Variables.
Kapi’olani Community College Art 258 Interface Programming II In-class Presentation Week 5A.
Introduction to Macromedia Flash 8
1 Flash Actionscript Adding Interactive Actions. 2 ActionScript 3.0 ActionScript is the language you use to add interactivity to Flash applications, whether.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
SM1205 Interactivity Topic 06: Iteration and Multiple Objects Spring 2010SCM-CityU1.
“But I don't want to be a “programmer!” ActionScript for journalists Presentation by Mindy McAdams Flashjournalism.com.
© 2011 Delmar, Cengage Learning Chapter 8 Building Complex Animations.
Frame Part of timeline panel You can remove normal frames from a certain layer by (MRC + Remove Frames). You can remove normal frames from a certain layer.
Chapter 3 Working with Symbols and Interactivity.
Introduction to Flash FYS100 Creative Discovery in Digital Art Forms Spring 2007 Burg.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
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.
Flash II MIS439 Eva Tao March 19, 2007 Source:
CT1514.  What is Motion Guide Layer?  Controls the movement of objects in a Motion tween animation  How to create a Motion Guide Layer?  Click on.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Symbols and Interactivity.
Lecture #26 Digital Video Editing II. Movie Editing Software iMovie Windows Live Movie Maker 2011 ( Adobe.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
Frame Part of timeline panel You can remove normal frames from a certain layer by (MRC + Remove Frames). يمكنك ازالة الاطر العادية من طبقة معينة باستخدام.
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.
Our Examples Video Capture Working With Interactive Video Objects Buttons symbols – are areas on the monitor that a sensitive to user actions such.
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.
Creating Scenes A scene in flash contains one or more layers that show related objects, in the stage, that act and interact to deliver a certain idea.
More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg.
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.
2006 Adobe Systems Incorporated. All Rights Reserved. 1 INTRODUCTION TO ADOBE FLASH CS3.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
Variables, Scope, Images, Sound IM ActionScript.
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.
WORKING WITH SOUND & VIDEO CHAPTER 7 PART I. USING SOUNDS Mp3 & WAV files Drag the sound files from the Library panel onto Stage at different points along.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Macromedia Flash Design Professional And Interactivity WORKING WITH SYMBOLS.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
Dr.Al-Mothana Gasaymeh. Mask layers تظهر ما تحت objects التي عليها كيفية عملها : كبسة يمين على الطبقة و اختيار Mask.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
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.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
Motion Tween Motion Tween allow us to move a shape on the stage from one place to another. تسمح بحركة الشكل من مكان الى اخر Motion Tween allow us to move.
DM 11- Flash –Unit C and Interactivity WORKING WITH SYMBOLS.
NumericStepper Component You can use the numeric stepper anywhere you want a user to select a numeric value. You can use the numeric stepper anywhere you.
Primitive Data Types 2. Boolean Data Type: It is used in logical operations to represent a certain state. هو يستخدم في العمليات المنطقية لتمثيل دالة معينة.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
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.
Macromedia Flash MX Design Professional And Interactivity WORKING WITH SYMBOLS.
 Movieclip symbols are reusable pieces of flash animation  consisting usually of one or more graphic/button symbols  thus they are flash movies within.
 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.
Topic 02: Introduction to ActionScript 3.0
var variableName:datatype;
ActionScript Basics 2016 (2.0 – 3.0)
Unit Lessons Work with actions
CT1514 Flash-2.
Interface Programming 2 Week 1
Flash Demonstration – Unit 5 – ActionScript 3.0
Presentation transcript:

Arrays in Flash What is an Array: What is an Array: Array is a list of cells, each cell in the list has a number to identify it (index or position). هي قائمة من الخلايا كل خلية في هذه القائمة لها رقم يعرفها Array is a list of cells, each cell in the list has a number to identify it (index or position). هي قائمة من الخلايا كل خلية في هذه القائمة لها رقم يعرفها Each cell can be used to hold information such as text, or a number, or an image. كل خلية يمكن ان تستخدم لتخزين نوع من معلومات...( أي في المصفوفة الوحدة يمكن ان نخزن اكثر من نوع من المعلومات ( يوجد توضيح على الدفتر )) Each cell can be used to hold information such as text, or a number, or an image. كل خلية يمكن ان تستخدم لتخزين نوع من معلومات...( أي في المصفوفة الوحدة يمكن ان نخزن اكثر من نوع من المعلومات ( يوجد توضيح على الدفتر )) Note: An Array size or length are the same thing. It refers to the number of cells that store information in the Array. حجم المصفوفة اوطولها نفس الشيء وهو يرجع عدد الخلايا المخزنة في المصفوفة Note: An Array size or length are the same thing. It refers to the number of cells that store information in the Array. حجم المصفوفة اوطولها نفس الشيء وهو يرجع عدد الخلايا المخزنة في المصفوفة

Arrays in Flash To declare an array variable inside flash, use the following general form: لتعريف المصفوفة متغيرة داخل الفلاش استخدم الشكل العام التالي :- To declare an array variable inside flash, use the following general form: لتعريف المصفوفة متغيرة داخل الفلاش استخدم الشكل العام التالي :- var array_name:Array = new Array(); Ex) var x:Array = new Array(); This statement will generate an empty array. هذه الجملة ستولد بشكل عام مصفوفة فارغة This statement will generate an empty array. هذه الجملة ستولد بشكل عام مصفوفة فارغة To insert a text element to this array: To insert a text element to this array: X[0] = some text ; //Here the text value ( some text ) will be added to the first element //of the array. To insert a new numeric element (at position 1): To insert a new numeric element (at position 1): X[1] = 4235; // here the value (4235) will be added to the second element of the //array.

Arrays in Flash Adding new elements to this array: Adding new elements to this array: x[2] = ab ; x[2] = ab ; X[3] = ; X[3] = ; X[4] = asd ; X[4] = asd ; You can notice that arrays created in flash can hold values with different data types. You can notice that arrays created in flash can hold values with different data types some text some text 4235 positions elements x ab ab asd asd

Arrays in Flash To get a value from the Array use: للحصول على قيمة من المصفوفة استخدم : To get a value from the Array use: للحصول على قيمة من المصفوفة استخدم : myArrayName[x]; myArrayName[x]; //Where x is index of the value from the Array you want to fetch. اكس هو موقع القيم التي تريد احضارها من المصفوفة Ex) to print the value stored at index (2) of the array defined in the previous example: trace(x[2]); Counting the Length of an Array: حساب طول المصفوفة Counting the Length of an Array: حساب طول المصفوفة To find the length of an array in flash use: To find the length of an array in flash use: array_name.length; array_name.length;

Arrays in Flash ex) the statement: ex) the statement:trace(x.length); will print (5) because array (x) has 5 elements. Exercise) 1. Try (push()) function to add elements to an array يستخدم لاضافة عناصر جديدة على المصفوفة ( على اخرها ) 2. Try (reverse()) function to order array elements in reverse order لاعادة ترتيب عناصر المصفوفة بشكل عكسي يوجد توضيح على الدفتر

Array Application Ex) This example shows how to control mouse cursor. The movements of mouse cursor will be captured and stored in an array. Then, these movements will be read and re-played again. هذا المثال يوضح كيفية التحكم بمؤشر الماوس بحيث يجمع حركات الماوس ويخزنها في مصفوفة ثم يقرا هذه الحركات ويشغلها Ex) This example shows how to control mouse cursor. The movements of mouse cursor will be captured and stored in an array. Then, these movements will be read and re-played again. هذا المثال يوضح كيفية التحكم بمؤشر الماوس بحيث يجمع حركات الماوس ويخزنها في مصفوفة ثم يقرا هذه الحركات ويشغلها 1. Create a new flash file. 2. Write stop(); statement in the action panel of the first frame. 3. Insert a button symbol onto the stage and write Start capturing as a caption. 4. Add the following actionscript to the action panel of the button. Select the button then click F9 the write:

Array Application on(release){gotoAndStop(5);} 1. Insert a key frame at frame# Write the following action script in the action panel of frame#5: var xa:Array=new Array(); var ya:Array= new Array(); onEnterFrame = function() {xa.push(_xmouse);ya.push(_ymouse);} _xmouse : return the x- coordinate of the current location of the mouse cursor on stage تعيد الاحداثي السيني للموقع الحالي لمؤشر الماوس على المسرح _ymouse : return the y-coordinate of the current location of the mouse cursor on stage تعيد الاحداثي الصادي للموقع الحالي لمؤشر الماوس على المسرح Both valuse will be added to both arrays كلا القيمتين سيضاف في مصفوفتين ( أي كل قيمة في مصفوفة ) This process will continue repeatedly تستمر هذه العملية بشكل متككرر

Array Application 1. Add a button onto the stage at frame#5 with Stop capturing as a caption. 2. In the action panel of that button, put the following actionsript: on(release){ delete onEnterFrame; gotoAndStop(10);} This statement is used to stop the running onEnterFrame function يستخدم لايقاف تشغيل Then, the movie transfers and stops at frame 10

Array Application 1. Insert a keyframe into frame#10 2. Insert a movie clip symbol onto the stage at this frame and give it (m) as an instance name. 3. In the action panel of this frame, write the following actionscript code:

var i:Number=0; onEnterFrame=function(){if(i<xa.length){ m._x = xa[i]; m._y = ya[i]; i=i+1;}else{ delete onEnterFrame; play();}} onEnterFrame repeats the process of reading x and y- coordinate values from the arrays (xa,ya) and giving them to the x and y coordinates of the (m) symbol. This will result in moving the (m) symbol يكرر عملية القراءة للاحداثيات من المصفوفات ويعطيها للرمزوبذلك يتحرك نفس حركة الماوس السابقة This onEnterFrame repeats the process of reading x and y- coordinate values from the arrays (xa,ya) and giving them to the x and y coordinates of the (m) symbol. This will result in moving the (m) symbol يكرر عملية القراءة للاحداثيات من المصفوفات ويعطيها للرمزوبذلك يتحرك نفس حركة الماوس السابقة