SlideShare une entreprise Scribd logo
1  sur  38
ARTDM 170, Week 5:
 Intro to Adobe Flash
         Gilbert Guerrero
        gguerrero@dvc.edu
gilbertguerrero.com/blog/artdm-170
Please turn in homework

• Last weekʼs homework was to create a
  Web page that used jQuery
• Put files in a folder with your lastname
  and first initial
• Example:
       smith-h
          myPage.html
          pic1.jpg
Group Projects
Adobe Flash
Open Flash and create a new
 ActionScript 3.0 document...
Basic ActionScript

• Click the first Keyframe in the
  timeline to select it
• Open the ActionScript window by
  going to Window > Actions
Trace output
  trace(“Hello World!”);

• Go to Control > Test Movie to test out
  your ActionScript
• trace helps troubleshoot code by
  sending notes to you in the Output
  window
Screen Output
var myText:TextField = new TextField();
myText.text = "Hello World!";
addChild(myText);

• The first line creates a new area to display
  the text, a textfield
• The second line puts your text in the
  textfield
• The third line adds the textfield to the stage
Display Objects
  var myText:TextField =
    new TextField();

• Visual elements that appear in
  ActionScript
• Such as textfields, graphics, buttons,
  movie clips, and user interface
  components
Object Properties
  myText.text =
    "Hello World!";

• Objects have properties
• Each object has itʼs own properties
• Properties of the objects can be
  changed directly
Display Lists
  addChild(myText);

• Creating objects does not add them
  to the stage. You must place them
  directly.
The Stage

• The main movie area where
 everything takes place that the user
 will see
The Library

• Where youʼll store all the media
  thatʼs associated with your Flash
  movie
The Timeline

• Frames
• Keyframes
• In-between Frames
• Empty Keyframes
• Labels
• Layers
Writing ActionScript
ActionScript Window

• Wonʼt use most of the buttons until
  you get used to ActionScript
• Use the Show/Hide Toolbox button to
  collapse the left column
• Disable Script Assist for now
Comments
    // single comment

    /*
    multi-line comment
    */
•   Comments are notes you can add for
    yourself or other developers
•   Comments can also be used to “turn off”
    code
Use descriptive naming

• Variable names:
               tennisBall,
  userRacket, userScore

• Function names: hitBall(
                        ),
  calcScore( ), headPunch( )
Use functions

• Use functions for repetitive tasks or
  tasks that appear in many places
  public function showTime() {
    timeDisplay.text =
      “Time: ” + timeElapsed;
  }

  showTime();
ActionScript Logic
if-else statements
if (this is true) {
    then do this
}
if-else statements
if (this is true) {
    then do this
} else {
    do this
}
if-else statements
if (this is true) {
    then do this
} else if (this is true) {
    then do this
} else {
    do this
}
Equal, not equal, or...
•   Assume this: a = 1;
                 b = 2;
                 c = 1;

•   These are true statements:
    (a == c)  a is equal to c
    (a != b)   a is not equal to b
    (a == 1 || c == 1)  a is equal to 1 or c is equal to 1
    (b > a)  b is greater than a
    (a >= c) a is greater than or equal to c
    (a + c == b) a plus c is equal to b
Variable Types

 • When they first appear, they must
   be declared using var
 • Variable type must also be
   declared (after the colon):

   var moveX:Number = 10;
Variable types
  Primitive:              Complex: 
  Boolean                 Object
  int                     Array
  null                    Date
  Number                  Error
                          Function
  String
                          RegExp
  uint
                          XML
  undefined                XMLList
• Declare any data type using an asterisk (*):
  var myX:*;
Placement

• An instance of a movie clip can be
 positioned at any location by
 assigning values to the x and y as
 coordinates:
myClip.x = 300;
myClip.y = 200;
Movement

• An instance of a movie clip can be
  moved by adding a value to x or y:
  myClip.x = myClip.x + 50;
  myClip.y = myClip.y + 50;
ActionScript Classes
Object Oriented Programming

• Object Oriented Programming (OOP)
  is way of writing code that uses
  objects as building blocks
• Your application can have many
  objects, each based on a single
  blueprint called a class
• Objects can have properties which is
  the data that makes each object
  unique
External ActionScript Files

• To place ActionScript in an external
  file, rather than embedding it in
  frames on the timeline, weʼre
  required to use OOP
• Weʼll be creating an ActionScript
  class to store our code
Your first ActionScript class

• Save your Flash file as
  HelloWorld2.fla
• Go to New... > ActionScript File   to
  create a new external AS file
• Save the file using the same name
  as your Flash file, example:
  HelloWorld2.as
ActionScript Class
package {
  import flash.display.*;
  import flash.text.*;


    public class HelloWorld extends MovieClip {


        public function HelloWorld() {
          var myText: TextField = new TextField();
          myText.text = "Hello World!";
          addChild(myText);
        }
    }
}
ActionScript Class
                Class file declaration
package {                  Library classes needed
  import flash.display.*;
  import flash.text.*;                Class definition
    public class HelloWorld2 extends MovieClip {


        public function HelloWorld2() {
          var myText: TextField = new TextField();
          myText.text = "Hello World!";
          addChild(myText);
        }
    }                                   Constructor
}
Constructors

• A constructor is a function that
  executes as soon as the class loads
• Must be named the same as the
  class
• Other functions come afterward
Putting it together

• To use the class in your Flash movie
  you must associate it with the movie.
• In the Properties panel associate the
  external AS file with HelloWorld.fla
  by typing the filename into the class
  field
Event Listeners
•   By using an event listener that's triggered by
    ENTER_FRAME the movie clip instance will move
    on it's own
    addEventListener(Event.ENTER_FRAME, myFunction);

    myBtn.addEventListener(MouseEvent.CLICK, myFunction);
Homework, due March 2

• Read p41-64, Chapter 2:
 ActionScript Game Elements in AS
 3.0 Game Programming University
Thank You

Contenu connexe

Tendances

JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016Codemotion
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Extending javascript part one
Extending javascript part oneExtending javascript part one
Extending javascript part oneVijaya Anand
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scalaRuslan Shevchenko
 
Java Static Factory Methods
Java Static Factory MethodsJava Static Factory Methods
Java Static Factory MethodsYe Win
 
Basic info on java intro
Basic info on java introBasic info on java intro
Basic info on java introkabirmahlotra
 
Scalable JavaScript Design Patterns
Scalable JavaScript Design PatternsScalable JavaScript Design Patterns
Scalable JavaScript Design PatternsAddy Osmani
 
Objective c runtime
Objective c runtimeObjective c runtime
Objective c runtimeInferis
 
React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & PromisesKnoldus Inc.
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modelingCodemotion
 

Tendances (18)

JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
25csharp
25csharp25csharp
25csharp
 
Lesson3
Lesson3Lesson3
Lesson3
 
Extending javascript part one
Extending javascript part oneExtending javascript part one
Extending javascript part one
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 
TypeScript 2 in action
TypeScript 2 in actionTypeScript 2 in action
TypeScript 2 in action
 
Java Static Factory Methods
Java Static Factory MethodsJava Static Factory Methods
Java Static Factory Methods
 
Basic info on java intro
Basic info on java introBasic info on java intro
Basic info on java intro
 
Scalable JavaScript Design Patterns
Scalable JavaScript Design PatternsScalable JavaScript Design Patterns
Scalable JavaScript Design Patterns
 
Unit ii
Unit iiUnit ii
Unit ii
 
Objective c runtime
Objective c runtimeObjective c runtime
Objective c runtime
 
Extending Node.js using C++
Extending Node.js using C++Extending Node.js using C++
Extending Node.js using C++
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
JavaScript Good Practices
JavaScript Good PracticesJavaScript Good Practices
JavaScript Good Practices
 
Scala Future & Promises
Scala Future & PromisesScala Future & Promises
Scala Future & Promises
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
 

Similaire à Artdm170 Week5 Intro To Flash

Coding Flash : ActionScript(3.0) Tutorial
Coding Flash :  ActionScript(3.0) TutorialCoding Flash :  ActionScript(3.0) Tutorial
Coding Flash : ActionScript(3.0) TutorialPEI-YAO HUNG
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろうUnity Technologies Japan K.K.
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
Artdm170 week6 scripting_motion
Artdm170 week6 scripting_motionArtdm170 week6 scripting_motion
Artdm170 week6 scripting_motionGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionGilbert Guerrero
 
IT 511 Final Project Guidelines and Grading Guide Ov.docx
IT 511 Final Project Guidelines and Grading Guide  Ov.docxIT 511 Final Project Guidelines and Grading Guide  Ov.docx
IT 511 Final Project Guidelines and Grading Guide Ov.docxpriestmanmable
 
Louis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLouis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLou Loizides
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UITech OneStop
 
iOS Programming Intro
iOS Programming IntroiOS Programming Intro
iOS Programming IntroLou Loizides
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
introduction to c #
introduction to c #introduction to c #
introduction to c #Sireesh K
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introductionSireesh K
 
Google tools for webmasters
Google tools for webmastersGoogle tools for webmasters
Google tools for webmastersRujata Patil
 

Similaire à Artdm170 Week5 Intro To Flash (20)

Coding Flash : ActionScript(3.0) Tutorial
Coding Flash :  ActionScript(3.0) TutorialCoding Flash :  ActionScript(3.0) Tutorial
Coding Flash : ActionScript(3.0) Tutorial
 
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
【Unite 2017 Tokyo】ScriptableObjectを使ってプログラマーもアーティストも幸せになろう
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Artdm170 week6 scripting_motion
Artdm170 week6 scripting_motionArtdm170 week6 scripting_motion
Artdm170 week6 scripting_motion
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Artdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting MotionArtdm170 Week6 Scripting Motion
Artdm170 Week6 Scripting Motion
 
Objective c
Objective cObjective c
Objective c
 
IT 511 Final Project Guidelines and Grading Guide Ov.docx
IT 511 Final Project Guidelines and Grading Guide  Ov.docxIT 511 Final Project Guidelines and Grading Guide  Ov.docx
IT 511 Final Project Guidelines and Grading Guide Ov.docx
 
Louis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLouis Loizides iOS Programming Introduction
Louis Loizides iOS Programming Introduction
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
 
Chapter iii(oop)
Chapter iii(oop)Chapter iii(oop)
Chapter iii(oop)
 
iOS Programming Intro
iOS Programming IntroiOS Programming Intro
iOS Programming Intro
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
C#2
C#2C#2
C#2
 
Group111
Group111Group111
Group111
 
introduction to c #
introduction to c #introduction to c #
introduction to c #
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
 
Google tools for webmasters
Google tools for webmastersGoogle tools for webmasters
Google tools for webmasters
 
Design patterns
Design patternsDesign patterns
Design patterns
 

Plus de Gilbert Guerrero

Designing for Skepticism and Bright Sunlight
Designing for Skepticism and Bright SunlightDesigning for Skepticism and Bright Sunlight
Designing for Skepticism and Bright SunlightGilbert Guerrero
 
ARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QAARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QAGilbert Guerrero
 
Artdm 170 week15 publishing
Artdm 170 week15 publishingArtdm 170 week15 publishing
Artdm 170 week15 publishingGilbert Guerrero
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysGilbert Guerrero
 
ARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to ProcessingARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to ProcessingGilbert Guerrero
 
ARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation SchemesARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation SchemesGilbert Guerrero
 
Artdm170 week12 user_interaction
Artdm170 week12 user_interactionArtdm170 week12 user_interaction
Artdm170 week12 user_interactionGilbert Guerrero
 
Artdm 171 Week12 Templates
Artdm 171 Week12 TemplatesArtdm 171 Week12 Templates
Artdm 171 Week12 TemplatesGilbert Guerrero
 
ARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page CompsARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page CompsGilbert Guerrero
 
ARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper PrototypesARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper PrototypesGilbert Guerrero
 
ARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User ExperienceARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User ExperienceGilbert Guerrero
 
ARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping CyberspaceARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping CyberspaceGilbert Guerrero
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityGilbert Guerrero
 
Artdm170 Week4 Java Script Effects
Artdm170 Week4 Java Script EffectsArtdm170 Week4 Java Script Effects
Artdm170 Week4 Java Script EffectsGilbert Guerrero
 
ARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group ProjectsARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group ProjectsGilbert Guerrero
 

Plus de Gilbert Guerrero (20)

Designing for Skepticism and Bright Sunlight
Designing for Skepticism and Bright SunlightDesigning for Skepticism and Bright Sunlight
Designing for Skepticism and Bright Sunlight
 
ARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QAARTDM 171, Week 17: Usability Testing and QA
ARTDM 171, Week 17: Usability Testing and QA
 
Artdm 171 week15 seo
Artdm 171 week15 seoArtdm 171 week15 seo
Artdm 171 week15 seo
 
Artdm 170 week15 publishing
Artdm 170 week15 publishingArtdm 170 week15 publishing
Artdm 170 week15 publishing
 
ARTDM 171, Week 14: Forms
ARTDM 171, Week 14: FormsARTDM 171, Week 14: Forms
ARTDM 171, Week 14: Forms
 
ARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + ArraysARTDM 170, Week 13: Text Elements + Arrays
ARTDM 170, Week 13: Text Elements + Arrays
 
ARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to ProcessingARTDM 170, Week 14: Introduction to Processing
ARTDM 170, Week 14: Introduction to Processing
 
ARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation SchemesARTDM 171, Week 13: Navigation Schemes
ARTDM 171, Week 13: Navigation Schemes
 
Artdm170 week12 user_interaction
Artdm170 week12 user_interactionArtdm170 week12 user_interaction
Artdm170 week12 user_interaction
 
Artdm 171 Week12 Templates
Artdm 171 Week12 TemplatesArtdm 171 Week12 Templates
Artdm 171 Week12 Templates
 
ARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page CompsARTDM 171, Week 10: Mood Boards + Page Comps
ARTDM 171, Week 10: Mood Boards + Page Comps
 
ARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper PrototypesARTDM 170, Week 10: Encapsulation + Paper Prototypes
ARTDM 170, Week 10: Encapsulation + Paper Prototypes
 
ARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User ExperienceARTDM 171, Week 9: User Experience
ARTDM 171, Week 9: User Experience
 
ARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping CyberspaceARTDM 171, Week 7: Remapping Cyberspace
ARTDM 171, Week 7: Remapping Cyberspace
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting Interactivity
 
Artdm171 Week6 Images
Artdm171 Week6 ImagesArtdm171 Week6 Images
Artdm171 Week6 Images
 
Artdm171 Week5 Css
Artdm171 Week5 CssArtdm171 Week5 Css
Artdm171 Week5 Css
 
Artdm171 Week4 Tags
Artdm171 Week4 TagsArtdm171 Week4 Tags
Artdm171 Week4 Tags
 
Artdm170 Week4 Java Script Effects
Artdm170 Week4 Java Script EffectsArtdm170 Week4 Java Script Effects
Artdm170 Week4 Java Script Effects
 
ARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group ProjectsARTDM 171, Week 3: Web Basics + Group Projects
ARTDM 171, Week 3: Web Basics + Group Projects
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Dernier (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Artdm170 Week5 Intro To Flash

  • 1. ARTDM 170, Week 5: Intro to Adobe Flash Gilbert Guerrero gguerrero@dvc.edu gilbertguerrero.com/blog/artdm-170
  • 2. Please turn in homework • Last weekʼs homework was to create a Web page that used jQuery • Put files in a folder with your lastname and first initial • Example:      smith-h myPage.html pic1.jpg
  • 4. Adobe Flash Open Flash and create a new ActionScript 3.0 document...
  • 5. Basic ActionScript • Click the first Keyframe in the timeline to select it • Open the ActionScript window by going to Window > Actions
  • 6. Trace output trace(“Hello World!”); • Go to Control > Test Movie to test out your ActionScript • trace helps troubleshoot code by sending notes to you in the Output window
  • 7. Screen Output var myText:TextField = new TextField(); myText.text = "Hello World!"; addChild(myText); • The first line creates a new area to display the text, a textfield • The second line puts your text in the textfield • The third line adds the textfield to the stage
  • 8. Display Objects var myText:TextField = new TextField(); • Visual elements that appear in ActionScript • Such as textfields, graphics, buttons, movie clips, and user interface components
  • 9. Object Properties myText.text = "Hello World!"; • Objects have properties • Each object has itʼs own properties • Properties of the objects can be changed directly
  • 10. Display Lists addChild(myText); • Creating objects does not add them to the stage. You must place them directly.
  • 11. The Stage • The main movie area where everything takes place that the user will see
  • 12. The Library • Where youʼll store all the media thatʼs associated with your Flash movie
  • 13. The Timeline • Frames • Keyframes • In-between Frames • Empty Keyframes • Labels • Layers
  • 15. ActionScript Window • Wonʼt use most of the buttons until you get used to ActionScript • Use the Show/Hide Toolbox button to collapse the left column • Disable Script Assist for now
  • 16. Comments // single comment /* multi-line comment */ • Comments are notes you can add for yourself or other developers • Comments can also be used to “turn off” code
  • 17. Use descriptive naming • Variable names: tennisBall, userRacket, userScore • Function names: hitBall( ), calcScore( ), headPunch( )
  • 18. Use functions • Use functions for repetitive tasks or tasks that appear in many places public function showTime() { timeDisplay.text = “Time: ” + timeElapsed; } showTime();
  • 20. if-else statements if (this is true) {     then do this }
  • 21. if-else statements if (this is true) {     then do this } else {     do this }
  • 22. if-else statements if (this is true) {     then do this } else if (this is true) {     then do this } else {     do this }
  • 23. Equal, not equal, or... • Assume this: a = 1; b = 2; c = 1; • These are true statements: (a == c)  a is equal to c (a != b)   a is not equal to b (a == 1 || c == 1)  a is equal to 1 or c is equal to 1 (b > a)  b is greater than a (a >= c) a is greater than or equal to c (a + c == b) a plus c is equal to b
  • 24. Variable Types • When they first appear, they must be declared using var • Variable type must also be declared (after the colon): var moveX:Number = 10;
  • 25. Variable types Primitive: Complex:  Boolean Object int Array null Date Number Error Function String RegExp uint XML undefined  XMLList • Declare any data type using an asterisk (*): var myX:*;
  • 26. Placement • An instance of a movie clip can be positioned at any location by assigning values to the x and y as coordinates: myClip.x = 300; myClip.y = 200;
  • 27. Movement • An instance of a movie clip can be moved by adding a value to x or y: myClip.x = myClip.x + 50; myClip.y = myClip.y + 50;
  • 29. Object Oriented Programming • Object Oriented Programming (OOP) is way of writing code that uses objects as building blocks • Your application can have many objects, each based on a single blueprint called a class • Objects can have properties which is the data that makes each object unique
  • 30. External ActionScript Files • To place ActionScript in an external file, rather than embedding it in frames on the timeline, weʼre required to use OOP • Weʼll be creating an ActionScript class to store our code
  • 31. Your first ActionScript class • Save your Flash file as HelloWorld2.fla • Go to New... > ActionScript File to create a new external AS file • Save the file using the same name as your Flash file, example: HelloWorld2.as
  • 32. ActionScript Class package { import flash.display.*; import flash.text.*; public class HelloWorld extends MovieClip { public function HelloWorld() { var myText: TextField = new TextField(); myText.text = "Hello World!"; addChild(myText); } } }
  • 33. ActionScript Class Class file declaration package { Library classes needed import flash.display.*; import flash.text.*; Class definition public class HelloWorld2 extends MovieClip { public function HelloWorld2() { var myText: TextField = new TextField(); myText.text = "Hello World!"; addChild(myText); } } Constructor }
  • 34. Constructors • A constructor is a function that executes as soon as the class loads • Must be named the same as the class • Other functions come afterward
  • 35. Putting it together • To use the class in your Flash movie you must associate it with the movie. • In the Properties panel associate the external AS file with HelloWorld.fla by typing the filename into the class field
  • 36. Event Listeners • By using an event listener that's triggered by ENTER_FRAME the movie clip instance will move on it's own addEventListener(Event.ENTER_FRAME, myFunction); myBtn.addEventListener(MouseEvent.CLICK, myFunction);
  • 37. Homework, due March 2 • Read p41-64, Chapter 2: ActionScript Game Elements in AS 3.0 Game Programming University

Notes de l'éditeur