SlideShare a Scribd company logo
Computer Animation with Flash CS3 & ActionScript 3.0 National Polytechnic Institute of Cambodia Bachelor of IT, Year III, Semester 1 2007-2008 by Oum Saokosal, Head of IT Department
ActionScript and the Flash Authoring Tool (Cont.) Computer Animation with Flash CS3 & ActionScript 3.0
ActionScript and the Flash Authoring Tool (Cont.) Linked Classes for Movie Clip Symbols Instantiating Symbols via ActionScript The Document Class
Linked Classes for Movie Clip Symbols (1) In ActionScript: Almost everything, except graphic, could be a class (including Button, Movie Clip, Sound etc). Every  instances  are objects
Linked Classes for Movie Clip Symbols (2) Q. But how to make the symbols be Classes? A. You have to link it. To link it, please Click on an existing symbol,e.g. Rectangle in Library Right Click -> Linkage Then check on “Export for ActionScript” -> OK -> OK
Instantiating Symbols via ActionScript As you know, every symbol can be classes. After you created a linked class, you can instantiate by  creating object  from the class. var rec1:mvRectangle =  new  mvRectangle(); rec1.x = 200; rec1.y = 50; addChild(rec1);  //Add an object to stage To instantiate(v) : To create instance
Important Codes (1) To create objects: var star:mvStar = new mvStar(); // Movie Clip var shortgun:ShortGun = new ShortGun(); // Sound To add the objects to stage: addChild(star); To hide/show mouse cursor: Mouse.hide(); //To hide Mouse.show(); //To show To play sound: shortgun.play();
Important Codes (2) To add Event to stage: stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownOnStage); Location of Mouse: mouseX; mouseY;
Lab: CreateStars Create stars in the sky by just clicking.
Lab: ShootingWall Shooting Wall (with Sound)
The Document Class (1) What is the Document Class? - The Document Class is a  external  ActionScript class file (*.as) which is linked to Flash documents (*.fla). - It helps to decouple coding from designing. That is, you design animations in Flash (*.fla) whereas you code in another external class file (*.as). - It enables you to use OOP features easily. -  Note  that it is available for AS 3.0 only.
The Document Class (2) How to create the Document Class? Create a new Flash file (AS3.0). Create animations. But you should create button or MovieClip symbols for  every part of animations . Then save the file, say,  FlashEx.fla. Next, create AS file by clicking on  File ->New ->ActionScript File. Write your codes. Then save it,  ASEx.as .
The Document Class (3) Please switch back to  FlashEx.fla . On the Flash file property, you will see a textbox called “Document Class”. Please type your AS file name, “ASEx”.
The Document Class (3) -  Sample 1. Open AS file:  HelloWorld.as package  { import flash.display.Sprite ; import flash.events.MouseEvent; public class  HelloWorld  extends Sprite  { public function  HelloWorld() { stage. addEventListener ( MouseEvent.MOUSE_DOWN ,  mouseDown); } private function  mouseDown (e: MouseEvent ): void  { trace ("Hello World"); } } }
The Document Class (3) -  Sample Open Flash (AS3.0) file On properties panel and in the Document Class, please write  HelloWorld
Lab: Exercise To rebuild the exercise CreateStars and ShootingWall by using document class. Hint:  In Flash file, create only symbols and then link them to be classes. In AS file, write code.

More Related Content

PPT
Libre office
PPTX
Photoshop Basics
DOCX
Uml Common Mechanism
PPTX
Power point tutorial
PDF
MySQL Proxy tutorial
PPTX
Lecture 1 introduction to flash
PDF
EMC Documentum - xCP 2.x Updating Java Services
PPT
MySQL and its basic commands
Libre office
Photoshop Basics
Uml Common Mechanism
Power point tutorial
MySQL Proxy tutorial
Lecture 1 introduction to flash
EMC Documentum - xCP 2.x Updating Java Services
MySQL and its basic commands

What's hot (20)

PPTX
Prototype model
PPT
Basics Of Photoshop
PPT
Adobe Flash History and Basics
PPTX
Cascading Style Sheet (CSS)
PPTX
Html5 tutorial for beginners
PPT
PPT
Css Ppt
PPT
PPT
Multimedia tools(images)
PDF
State chart diagram
PPTX
Adobe After Effects
PPTX
PHP environment setup installation
PPTX
Presentation on Adobe Photoshop
PPTX
How to prepare a paper base presentation
DOCX
Photoshop tools and their functions
PPTX
Virtual function and abstract class
PPTX
Presentation on uml
PPTX
Hypertext, hypermedia and multimedia
Prototype model
Basics Of Photoshop
Adobe Flash History and Basics
Cascading Style Sheet (CSS)
Html5 tutorial for beginners
Css Ppt
Multimedia tools(images)
State chart diagram
Adobe After Effects
PHP environment setup installation
Presentation on Adobe Photoshop
How to prepare a paper base presentation
Photoshop tools and their functions
Virtual function and abstract class
Presentation on uml
Hypertext, hypermedia and multimedia
Ad

Viewers also liked (20)

PPT
Actionscript 3 - Session 1 Introduction To As 3
PPT
ActionScript Presentation
PPT
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
PPT
ActionScript 3.0 Fundamentals
PDF
Action Script
PPT
Actionscript 3 - Session 6 Interactivity
PPT
Actionscript 3 - Session 5 The Display Api And The Display List
PPT
How To Create A Video With Titles In Movie Maker And Then Convert To Flash M...
PPT
Chapter 9 Interface
PPT
Actionscript 3 - Session 2 Getting Started Flash IDE
PPT
Actionscript 3 - Session 7 Other Note
KEY
Coding Flash : ActionScript(3.0) Tutorial
PPTX
Action Script 3 With Flash Cs3
PPTX
How to create a simple image gallery in flash cs5
PPTX
Adobe flash cs6
PPTX
Step by step - Buttons
PPT
Chapter 8 Inheritance
PDF
Action script for designers
PDF
Big Data is not Rocket Science
PPT
Introduction To Flash
Actionscript 3 - Session 1 Introduction To As 3
ActionScript Presentation
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
ActionScript 3.0 Fundamentals
Action Script
Actionscript 3 - Session 6 Interactivity
Actionscript 3 - Session 5 The Display Api And The Display List
How To Create A Video With Titles In Movie Maker And Then Convert To Flash M...
Chapter 9 Interface
Actionscript 3 - Session 2 Getting Started Flash IDE
Actionscript 3 - Session 7 Other Note
Coding Flash : ActionScript(3.0) Tutorial
Action Script 3 With Flash Cs3
How to create a simple image gallery in flash cs5
Adobe flash cs6
Step by step - Buttons
Chapter 8 Inheritance
Action script for designers
Big Data is not Rocket Science
Introduction To Flash
Ad

Similar to Actionscript 3 - Session 3 Action Script And Flash (20)

PPTX
Going Mobile with AIR+Starling
PPTX
javaprogramming framework-ppt frame.pptx
PPT
Display Programming
PDF
Desenvolva um game para android ou iPhone
PDF
How to create interactive infographics
PPTX
Flash
KEY
Artdm170 Week5 Intro To Flash
PDF
Introductontoxaml
PDF
GNURAdioDoc-8
PDF
GNURAdioDoc-8
PPT
Objective c
PPTX
ARTDM 170 Week 8: Scripting Interactivity
PPT
Android Development with Flash Builder Burrito
PPT
Gdc09 Minigames
PPT
Janus Mobile e-Seminar
PDF
Flash Presentation 25.11.10
PDF
Actionscript 3 with FlashDevelop3
DOCX
IT 511 Final Project Guidelines and Grading Guide Ov.docx
DOCX
Om Pawar MP AJP.docx
PDF
How tomakea gameinunity3d
Going Mobile with AIR+Starling
javaprogramming framework-ppt frame.pptx
Display Programming
Desenvolva um game para android ou iPhone
How to create interactive infographics
Flash
Artdm170 Week5 Intro To Flash
Introductontoxaml
GNURAdioDoc-8
GNURAdioDoc-8
Objective c
ARTDM 170 Week 8: Scripting Interactivity
Android Development with Flash Builder Burrito
Gdc09 Minigames
Janus Mobile e-Seminar
Flash Presentation 25.11.10
Actionscript 3 with FlashDevelop3
IT 511 Final Project Guidelines and Grading Guide Ov.docx
Om Pawar MP AJP.docx
How tomakea gameinunity3d

More from OUM SAOKOSAL (20)

PPTX
Class Diagram | OOP and Design Patterns by Oum Saokosal
PPTX
Android app development - Java Programming for Android
PDF
Java OOP Programming language (Part 8) - Java Database JDBC
PDF
Java OOP Programming language (Part 7) - Swing
PDF
Java OOP Programming language (Part 6) - Abstract Class & Interface
PDF
Java OOP Programming language (Part 5) - Inheritance
PDF
Java OOP Programming language (Part 4) - Collection
PDF
Java OOP Programming language (Part 3) - Class and Object
PDF
Java OOP Programming language (Part 1) - Introduction to Java
PDF
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
PDF
Aggregate rank bringing order to web sites
DOC
How to succeed in graduate school
PDF
Google
PDF
E miner
PDF
Data preparation for mining world wide web browsing patterns (1999)
PDF
Consumer acceptance of online banking an extension of the technology accepta...
DOCX
When Do People Help
DOC
Mc Nemar
DOCX
Correlation Example
DOC
Sem Ski Amos
Class Diagram | OOP and Design Patterns by Oum Saokosal
Android app development - Java Programming for Android
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 7) - Swing
Java OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 1) - Introduction to Java
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
Aggregate rank bringing order to web sites
How to succeed in graduate school
Google
E miner
Data preparation for mining world wide web browsing patterns (1999)
Consumer acceptance of online banking an extension of the technology accepta...
When Do People Help
Mc Nemar
Correlation Example
Sem Ski Amos

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PDF
cuic standard and advanced reporting.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Reach Out and Touch Someone: Haptics and Empathic Computing
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
cuic standard and advanced reporting.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Machine learning based COVID-19 study performance prediction
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Actionscript 3 - Session 3 Action Script And Flash

  • 1. Computer Animation with Flash CS3 & ActionScript 3.0 National Polytechnic Institute of Cambodia Bachelor of IT, Year III, Semester 1 2007-2008 by Oum Saokosal, Head of IT Department
  • 2. ActionScript and the Flash Authoring Tool (Cont.) Computer Animation with Flash CS3 & ActionScript 3.0
  • 3. ActionScript and the Flash Authoring Tool (Cont.) Linked Classes for Movie Clip Symbols Instantiating Symbols via ActionScript The Document Class
  • 4. Linked Classes for Movie Clip Symbols (1) In ActionScript: Almost everything, except graphic, could be a class (including Button, Movie Clip, Sound etc). Every instances are objects
  • 5. Linked Classes for Movie Clip Symbols (2) Q. But how to make the symbols be Classes? A. You have to link it. To link it, please Click on an existing symbol,e.g. Rectangle in Library Right Click -> Linkage Then check on “Export for ActionScript” -> OK -> OK
  • 6. Instantiating Symbols via ActionScript As you know, every symbol can be classes. After you created a linked class, you can instantiate by creating object from the class. var rec1:mvRectangle = new mvRectangle(); rec1.x = 200; rec1.y = 50; addChild(rec1); //Add an object to stage To instantiate(v) : To create instance
  • 7. Important Codes (1) To create objects: var star:mvStar = new mvStar(); // Movie Clip var shortgun:ShortGun = new ShortGun(); // Sound To add the objects to stage: addChild(star); To hide/show mouse cursor: Mouse.hide(); //To hide Mouse.show(); //To show To play sound: shortgun.play();
  • 8. Important Codes (2) To add Event to stage: stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownOnStage); Location of Mouse: mouseX; mouseY;
  • 9. Lab: CreateStars Create stars in the sky by just clicking.
  • 10. Lab: ShootingWall Shooting Wall (with Sound)
  • 11. The Document Class (1) What is the Document Class? - The Document Class is a external ActionScript class file (*.as) which is linked to Flash documents (*.fla). - It helps to decouple coding from designing. That is, you design animations in Flash (*.fla) whereas you code in another external class file (*.as). - It enables you to use OOP features easily. - Note that it is available for AS 3.0 only.
  • 12. The Document Class (2) How to create the Document Class? Create a new Flash file (AS3.0). Create animations. But you should create button or MovieClip symbols for every part of animations . Then save the file, say, FlashEx.fla. Next, create AS file by clicking on File ->New ->ActionScript File. Write your codes. Then save it, ASEx.as .
  • 13. The Document Class (3) Please switch back to FlashEx.fla . On the Flash file property, you will see a textbox called “Document Class”. Please type your AS file name, “ASEx”.
  • 14. The Document Class (3) - Sample 1. Open AS file: HelloWorld.as package { import flash.display.Sprite ; import flash.events.MouseEvent; public class HelloWorld extends Sprite { public function HelloWorld() { stage. addEventListener ( MouseEvent.MOUSE_DOWN , mouseDown); } private function mouseDown (e: MouseEvent ): void { trace ("Hello World"); } } }
  • 15. The Document Class (3) - Sample Open Flash (AS3.0) file On properties panel and in the Document Class, please write HelloWorld
  • 16. Lab: Exercise To rebuild the exercise CreateStars and ShootingWall by using document class. Hint: In Flash file, create only symbols and then link them to be classes. In AS file, write code.