SlideShare a Scribd company logo
Vorig college

• Variabelen: var i:int = 7;
• Instanties
• Trace: trace(i); // Resultaat: 7
• Expressies: i < 10; // Resultaat: true;
• Conditional statements: if(i > 10) { code; }
Onderwerpen

• AS3 Reference Guide
• Eventlisteners
• Functies
• Constanten
AS3 Reference Guide

• Flash CS 3, Flash Player 9, ActionScript 3
• Flash CS 4, Flash Player 10.1, ActionScript 3
• http://livedocs.adobe.com/flash/9.0/
  ActionScriptLangRefV3/
Eventlisteners

• Imports en libraries
• import flash.events.Event;
• addEventListener(event, functie);
• startButton.addEventListener(MouseEvent.
  CLICK, startRotation);
Eventlisteners


  variabele                       constante        referentie
startButton.addEventListener(MouseEvent.CLICK, startRotation);
  waaraan?                       welk event?     welke functie?
Functies

• Hergebruiken van code
• Abstractie
• Leesbaarheid
Pythagoras

• c= + √(a 2   b2)


• function pythagoras(a:Number, b:Number):Number {
      var c:Number = Math.pow(a, 2) + Math.pow(b, 2);
      return Math.sqrt(c);
  }
• var r:Number = pythagoras(3, 4); // Resultaat: 5
Pythagoras

• c= + √(a 2   b2)


• function pythagoras(a:Number, b:Number):Number {
      var c:Number = Math.pow(a, 2) + Math.pow(b, 2);
      return Math.sqrt(c);
  }
• var r:Number = pythagoras(3, 4); // Resultaat: 5
Pythagoras

• c= + √(a 2   b2)


• function pythagoras(a:Number, b:Number):Number {
      var c:Number = Math.pow(a, 2) + Math.pow(b, 2);
      return Math.sqrt(c);
  }
• var r:Number = pythagoras(3, 4); // Resultaat: 5
Functies
• Functie-naam
• Parameters + types
• Return-waarde + type
• Code
• Return
• Void
Som

• function som(a:Number, b:Number):Number
  {
      return a + b;
  }
• var s:Number = som(2, 3); // Resultaat: 5
Product

• function product(a:Number, b:Number):Number
  {
      return a * b;
  }
• var p:Number = product(3, 3); // Resultaat: 9
Round
• function round(n:Number):int
  {
      var m:Number = n % 1;
      if(m < .5)
         return n - m;
      else
         return n - m + 1;
  }
• var r:int = round(3.49991); // Resultaat: 4
• var r:int = round(6.789); // Resultaat: 7
Constanten

• Niet-veranderende waarde
• Variabele: wel-veranderende waarde
• Getallen: 1, 2, 5, 123, 1.47
• Wiskunde: Math.PI, Math.E, Math.LN10
• Events: MouseEvent.CLICK,
  Event.ENTER_FRAME
Eventlisteners


  variabele                       constante    referentie naar functie
startButton.addEventListener(MouseEvent.CLICK, startRotation);
  waaraan?                       welk event?       welke functie?
Eventlistener

• Variabele
• addEventListener()
• Constante, bijv. Event.ENTER_FRAME
• Functie, bijv. onEnterFrame
• Functie zonder parameters of haakjes
Event en functie

• startButton.addEventListener(MouseEvent.CLICK,
  startRotation);
• function startRotation(e:MouseEvent):void {
      trace("Start met roteren");
      isRotating = true;
  }
Event en functie

• Event “klik” toevoegen aan startButton
• Als er geklikt wordt, voer startRotation uit
• Parameter: e van type MouseEvent
• Resultaat: void (niks!)
Voorbeeld: draaiende appel
• Importeren events
• Boolean isRotating, moet de appel draaien?
• Toevoegen 3 eventlisteners: elk frame,
   start, stop
• Functie: elk frame, moet de appel draaien?
   Ja? Draai de appel.
• Functie: start met roteren, zet isRotating is
   true.
• Functie: stop met roteren, zet isRotating is
   false
Code-voorbeelden

• Draaiende appel: eventlisteners
• Functies: verschillende functies, o.a. map()
• Draaiende appel 2: eventlisteners en
  functies
Opdracht

• Maak een Flash-movie, met een lampje
  (MovieClip) die aan en uit kan m.b.v. twee
  buttons.
• Tip: elke MovieClip heeft de property
  “visible” (Boolean).

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

College 2 ActionScript 3

  • 1. Vorig college • Variabelen: var i:int = 7; • Instanties • Trace: trace(i); // Resultaat: 7 • Expressies: i < 10; // Resultaat: true; • Conditional statements: if(i > 10) { code; }
  • 2. Onderwerpen • AS3 Reference Guide • Eventlisteners • Functies • Constanten
  • 3. AS3 Reference Guide • Flash CS 3, Flash Player 9, ActionScript 3 • Flash CS 4, Flash Player 10.1, ActionScript 3 • http://livedocs.adobe.com/flash/9.0/ ActionScriptLangRefV3/
  • 4. Eventlisteners • Imports en libraries • import flash.events.Event; • addEventListener(event, functie); • startButton.addEventListener(MouseEvent. CLICK, startRotation);
  • 5. Eventlisteners variabele constante referentie startButton.addEventListener(MouseEvent.CLICK, startRotation); waaraan? welk event? welke functie?
  • 6. Functies • Hergebruiken van code • Abstractie • Leesbaarheid
  • 7. Pythagoras • c= + √(a 2 b2) • function pythagoras(a:Number, b:Number):Number { var c:Number = Math.pow(a, 2) + Math.pow(b, 2); return Math.sqrt(c); } • var r:Number = pythagoras(3, 4); // Resultaat: 5
  • 8. Pythagoras • c= + √(a 2 b2) • function pythagoras(a:Number, b:Number):Number { var c:Number = Math.pow(a, 2) + Math.pow(b, 2); return Math.sqrt(c); } • var r:Number = pythagoras(3, 4); // Resultaat: 5
  • 9. Pythagoras • c= + √(a 2 b2) • function pythagoras(a:Number, b:Number):Number { var c:Number = Math.pow(a, 2) + Math.pow(b, 2); return Math.sqrt(c); } • var r:Number = pythagoras(3, 4); // Resultaat: 5
  • 10. Functies • Functie-naam • Parameters + types • Return-waarde + type • Code • Return • Void
  • 11. Som • function som(a:Number, b:Number):Number { return a + b; } • var s:Number = som(2, 3); // Resultaat: 5
  • 12. Product • function product(a:Number, b:Number):Number { return a * b; } • var p:Number = product(3, 3); // Resultaat: 9
  • 13. Round • function round(n:Number):int { var m:Number = n % 1; if(m < .5) return n - m; else return n - m + 1; } • var r:int = round(3.49991); // Resultaat: 4 • var r:int = round(6.789); // Resultaat: 7
  • 14. Constanten • Niet-veranderende waarde • Variabele: wel-veranderende waarde • Getallen: 1, 2, 5, 123, 1.47 • Wiskunde: Math.PI, Math.E, Math.LN10 • Events: MouseEvent.CLICK, Event.ENTER_FRAME
  • 15. Eventlisteners variabele constante referentie naar functie startButton.addEventListener(MouseEvent.CLICK, startRotation); waaraan? welk event? welke functie?
  • 16. Eventlistener • Variabele • addEventListener() • Constante, bijv. Event.ENTER_FRAME • Functie, bijv. onEnterFrame • Functie zonder parameters of haakjes
  • 17. Event en functie • startButton.addEventListener(MouseEvent.CLICK, startRotation); • function startRotation(e:MouseEvent):void { trace("Start met roteren"); isRotating = true; }
  • 18. Event en functie • Event “klik” toevoegen aan startButton • Als er geklikt wordt, voer startRotation uit • Parameter: e van type MouseEvent • Resultaat: void (niks!)
  • 19. Voorbeeld: draaiende appel • Importeren events • Boolean isRotating, moet de appel draaien? • Toevoegen 3 eventlisteners: elk frame, start, stop • Functie: elk frame, moet de appel draaien? Ja? Draai de appel. • Functie: start met roteren, zet isRotating is true. • Functie: stop met roteren, zet isRotating is false
  • 20. Code-voorbeelden • Draaiende appel: eventlisteners • Functies: verschillende functies, o.a. map() • Draaiende appel 2: eventlisteners en functies
  • 21. Opdracht • Maak een Flash-movie, met een lampje (MovieClip) die aan en uit kan m.b.v. twee buttons. • Tip: elke MovieClip heeft de property “visible” (Boolean).

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n