SlideShare a Scribd company logo
1 of 4
Download to read offline
Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007
Jukka Paasonen 1(4)
Creating rich Internet applications has become more easier but also more demanding.
Flex 2 SDK and FlashDevelop3 offers an free way of building Flash 9 applications.
This document describes how to install the latest versions of these tools and how to start
some initial Flash programming.
Installation
First download Flex 2 SDK from Adobe.com:
http://www.adobe.com/products/flex/downloads/
http://download.macromedia.com/pub/flex/sdk/flex2_sdk_hf1.zip
FlashDevelop3 also works with the beta version of Flex SDK, in case you wish to use that. It
offers the possibility to compile Air applications for example.
Second thing is to get the latest FlashDevelop3. You can download it from:
http://www.flashdevelop.org/community/index.php
section “releases”. As the time of writing, it is beta 3.
If you like to try out the latest development build, go to:
http://www.flashdevelop.org/community/viewtopic.php?t=1734
Installation is rather straight forward, unzip the Flex 2 SDK wherever you like and after
installing FlashDevelop3, change the AS3 plugin settings to point in the Flex SDK directory.
This can be found from “Tools – Installed Plugins – AS3Context”. Image 1 hopefully clears
this a bit.
Image 1. FlashDevelop3 AS3Context plugin settings dialog.
Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007
Jukka Paasonen 2(4)
Programming
Writing code in plain Actionscript 3, which then in turn is compiled to AVM2 byte code by
using Flex SDK, requires some additional care.
Each file you write must belong to a package. You can consider this to be a hint for the
compiler of what are the limits of your codes scope.
Usually when writing code in Flash authoring tool, the tool itself takes care of this and the
scope is usually the movie clip you are working on.
Another thing is to note that Actionscript 3 is heavily Object Oriented and you should
always use classes, possibly extending those, which already exist in the SDK.
The short example here shows how the structure of Actionscript 3 class looks like, complete
file (FlagFinland.as) available at http://paazio.nanbudo.fi/, where you downloaded this
document too.
The basic structure usually follows the formula below:
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width="360", height="220", frameRate="33", backgroundColor="#FFFFFF")]
public class FlagFinland extends Sprite {
public function FlagFinland() {
this.loaderInfo.addEventListener(Event.INIT, init);
}
private function init(evt:Event):void {
// Draw graphics here...
}
}
}
This time I will build an small application to draw the Finnish flag. For that, I need to add
some more imports:
Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007
Jukka Paasonen 3(4)
import flash.display.Graphics;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageDisplayState;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
Notice the several “Stage...” imports. They are all used to set proper scaling and alignment.
These are usually set in the constructor function:
public function FlagFinland() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.MEDIUM;
stage.addEventListener(Event.RESIZE, onResize);
this.loaderInfo.addEventListener(Event.INIT, init);
}
There are two event listeners defined. The first one for resizing and the second to be run
when the whole flash file has been loaded:
private function init(evt:Event):void {
drawFlag();
}
private function onResize(evt:Event):void {
drawFlag();
}
Both of these call the same function, which in turn will do the drawing. That function and
the complete package is available at http://paazio.nanbudo.fi/
Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007
Jukka Paasonen 4(4)
Compiling of the file is easy, just click on the “Build Current File” button on the toolbar, as
shown in image 2.
Image 2. Toolbar with the compile button hovered.

More Related Content

Viewers also liked

Speedpresentatie Geavanceerd Zoeken
Speedpresentatie Geavanceerd ZoekenSpeedpresentatie Geavanceerd Zoeken
Speedpresentatie Geavanceerd ZoekenNienkeMcMurter
 
Design implementation imporovements with QML
Design implementation imporovements with QMLDesign implementation imporovements with QML
Design implementation imporovements with QMLJuga Paazmaya
 
Flash MX Tutorial - Preloader
Flash MX Tutorial - PreloaderFlash MX Tutorial - Preloader
Flash MX Tutorial - PreloaderJuga Paazmaya
 
Two Caged Tigers
Two Caged TigersTwo Caged Tigers
Two Caged TigersThea Westra
 
Pfizer
PfizerPfizer
PfizerP_100
 
Welcom online
Welcom onlineWelcom online
Welcom onlineP_100
 
Tekko Process 2003 Autumn
Tekko Process 2003 AutumnTekko Process 2003 Autumn
Tekko Process 2003 AutumnJuga Paazmaya
 
Flash MX Tutorial - Tweens
Flash MX Tutorial - TweensFlash MX Tutorial - Tweens
Flash MX Tutorial - TweensJuga Paazmaya
 
Educating The Next Generation Of Translation And Interpreters
Educating  The Next Generation Of Translation And InterpretersEducating  The Next Generation Of Translation And Interpreters
Educating The Next Generation Of Translation And Interpretersallinportuguese
 
Vette Klei
Vette KleiVette Klei
Vette KleiP_100
 
Flash MX Tutorial - Big wave
Flash MX Tutorial - Big waveFlash MX Tutorial - Big wave
Flash MX Tutorial - Big waveJuga Paazmaya
 
What Every Translator Should Know About Software Localization
What Every Translator Should Know About Software LocalizationWhat Every Translator Should Know About Software Localization
What Every Translator Should Know About Software Localizationallinportuguese
 
Flash MX Tutorial - Scrolling content
Flash MX Tutorial - Scrolling contentFlash MX Tutorial - Scrolling content
Flash MX Tutorial - Scrolling contentJuga Paazmaya
 
Mixing Computer-Assisted Translation and Machine Translation
Mixing Computer-Assisted Translation and Machine TranslationMixing Computer-Assisted Translation and Machine Translation
Mixing Computer-Assisted Translation and Machine Translationallinportuguese
 

Viewers also liked (16)

Speedpresentatie Geavanceerd Zoeken
Speedpresentatie Geavanceerd ZoekenSpeedpresentatie Geavanceerd Zoeken
Speedpresentatie Geavanceerd Zoeken
 
Design implementation imporovements with QML
Design implementation imporovements with QMLDesign implementation imporovements with QML
Design implementation imporovements with QML
 
Flash MX Tutorial - Preloader
Flash MX Tutorial - PreloaderFlash MX Tutorial - Preloader
Flash MX Tutorial - Preloader
 
Two Caged Tigers
Two Caged TigersTwo Caged Tigers
Two Caged Tigers
 
Testing In Java4278
Testing In Java4278Testing In Java4278
Testing In Java4278
 
Pfizer
PfizerPfizer
Pfizer
 
Powerpoint Opdracht 2
Powerpoint Opdracht 2Powerpoint Opdracht 2
Powerpoint Opdracht 2
 
Welcom online
Welcom onlineWelcom online
Welcom online
 
Tekko Process 2003 Autumn
Tekko Process 2003 AutumnTekko Process 2003 Autumn
Tekko Process 2003 Autumn
 
Flash MX Tutorial - Tweens
Flash MX Tutorial - TweensFlash MX Tutorial - Tweens
Flash MX Tutorial - Tweens
 
Educating The Next Generation Of Translation And Interpreters
Educating  The Next Generation Of Translation And InterpretersEducating  The Next Generation Of Translation And Interpreters
Educating The Next Generation Of Translation And Interpreters
 
Vette Klei
Vette KleiVette Klei
Vette Klei
 
Flash MX Tutorial - Big wave
Flash MX Tutorial - Big waveFlash MX Tutorial - Big wave
Flash MX Tutorial - Big wave
 
What Every Translator Should Know About Software Localization
What Every Translator Should Know About Software LocalizationWhat Every Translator Should Know About Software Localization
What Every Translator Should Know About Software Localization
 
Flash MX Tutorial - Scrolling content
Flash MX Tutorial - Scrolling contentFlash MX Tutorial - Scrolling content
Flash MX Tutorial - Scrolling content
 
Mixing Computer-Assisted Translation and Machine Translation
Mixing Computer-Assisted Translation and Machine TranslationMixing Computer-Assisted Translation and Machine Translation
Mixing Computer-Assisted Translation and Machine Translation
 

Similar to Actionscript 3 with FlashDevelop3

Flex3中文教程
Flex3中文教程Flex3中文教程
Flex3中文教程yiditushe
 
Integrate Flex With Spring Framework
Integrate Flex With Spring FrameworkIntegrate Flex With Spring Framework
Integrate Flex With Spring FrameworkGuo Albert
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash PlatformPeter Elst
 
Osvrt Na Adobe Max 2009
Osvrt Na Adobe Max 2009Osvrt Na Adobe Max 2009
Osvrt Na Adobe Max 2009Ivan Ilijasic
 
Asp net mvc
Asp net mvcAsp net mvc
Asp net mvcbgrynko
 
SPFx Team based Development using Docker
SPFx Team based Development using DockerSPFx Team based Development using Docker
SPFx Team based Development using DockerJenkins NS
 
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0Peter Elst
 
How to Get started with Press2Flash in 8 Steps
How to Get started with Press2Flash in 8 StepsHow to Get started with Press2Flash in 8 Steps
How to Get started with Press2Flash in 8 StepsErwan Jegouzo
 
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTreeThe Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTreeRedBlackTree
 
flex and flash platform
flex and flash platformflex and flash platform
flex and flash platformMuhammad Rodhy
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxmoirarandell
 
Introduction to Adobe Flex
Introduction to Adobe FlexIntroduction to Adobe Flex
Introduction to Adobe FlexAngelin R
 

Similar to Actionscript 3 with FlashDevelop3 (20)

Flex3中文教程
Flex3中文教程Flex3中文教程
Flex3中文教程
 
Integrate Flex With Spring Framework
Integrate Flex With Spring FrameworkIntegrate Flex With Spring Framework
Integrate Flex With Spring Framework
 
DIY Flex
DIY FlexDIY Flex
DIY Flex
 
DIY Flex
DIY FlexDIY Flex
DIY Flex
 
The Evolution of the Flash Platform
The Evolution of the Flash PlatformThe Evolution of the Flash Platform
The Evolution of the Flash Platform
 
Flask
FlaskFlask
Flask
 
Osvrt Na Adobe Max 2009
Osvrt Na Adobe Max 2009Osvrt Na Adobe Max 2009
Osvrt Na Adobe Max 2009
 
Fltk tutorial
Fltk tutorialFltk tutorial
Fltk tutorial
 
Asp net mvc
Asp net mvcAsp net mvc
Asp net mvc
 
Flex and Java
Flex and JavaFlex and Java
Flex and Java
 
Adobe flex
Adobe flexAdobe flex
Adobe flex
 
SPFx Team based Development using Docker
SPFx Team based Development using DockerSPFx Team based Development using Docker
SPFx Team based Development using Docker
 
Another Test
Another TestAnother Test
Another Test
 
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
SkillsMatter - In-the-Brain session - What's new in ActionScript 3.0
 
How to Get started with Press2Flash in 8 Steps
How to Get started with Press2Flash in 8 StepsHow to Get started with Press2Flash in 8 Steps
How to Get started with Press2Flash in 8 Steps
 
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTreeThe Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
The Mobile ToolChain with Fastlane - Code Red Talk at RedBlackTree
 
flex and flash platform
flex and flash platformflex and flash platform
flex and flash platform
 
BLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docxBLCN532 Lab 1Set up your development environmentV2.0.docx
BLCN532 Lab 1Set up your development environmentV2.0.docx
 
Introduction to Adobe Flex
Introduction to Adobe FlexIntroduction to Adobe Flex
Introduction to Adobe Flex
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
 

Recently uploaded

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Actionscript 3 with FlashDevelop3

  • 1. Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007 Jukka Paasonen 1(4) Creating rich Internet applications has become more easier but also more demanding. Flex 2 SDK and FlashDevelop3 offers an free way of building Flash 9 applications. This document describes how to install the latest versions of these tools and how to start some initial Flash programming. Installation First download Flex 2 SDK from Adobe.com: http://www.adobe.com/products/flex/downloads/ http://download.macromedia.com/pub/flex/sdk/flex2_sdk_hf1.zip FlashDevelop3 also works with the beta version of Flex SDK, in case you wish to use that. It offers the possibility to compile Air applications for example. Second thing is to get the latest FlashDevelop3. You can download it from: http://www.flashdevelop.org/community/index.php section “releases”. As the time of writing, it is beta 3. If you like to try out the latest development build, go to: http://www.flashdevelop.org/community/viewtopic.php?t=1734 Installation is rather straight forward, unzip the Flex 2 SDK wherever you like and after installing FlashDevelop3, change the AS3 plugin settings to point in the Flex SDK directory. This can be found from “Tools – Installed Plugins – AS3Context”. Image 1 hopefully clears this a bit. Image 1. FlashDevelop3 AS3Context plugin settings dialog.
  • 2. Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007 Jukka Paasonen 2(4) Programming Writing code in plain Actionscript 3, which then in turn is compiled to AVM2 byte code by using Flex SDK, requires some additional care. Each file you write must belong to a package. You can consider this to be a hint for the compiler of what are the limits of your codes scope. Usually when writing code in Flash authoring tool, the tool itself takes care of this and the scope is usually the movie clip you are working on. Another thing is to note that Actionscript 3 is heavily Object Oriented and you should always use classes, possibly extending those, which already exist in the SDK. The short example here shows how the structure of Actionscript 3 class looks like, complete file (FlagFinland.as) available at http://paazio.nanbudo.fi/, where you downloaded this document too. The basic structure usually follows the formula below: package { import flash.display.Sprite; import flash.events.Event; [SWF(width="360", height="220", frameRate="33", backgroundColor="#FFFFFF")] public class FlagFinland extends Sprite { public function FlagFinland() { this.loaderInfo.addEventListener(Event.INIT, init); } private function init(evt:Event):void { // Draw graphics here... } } } This time I will build an small application to draw the Finnish flag. For that, I need to add some more imports:
  • 3. Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007 Jukka Paasonen 3(4) import flash.display.Graphics; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageDisplayState; import flash.display.StageQuality; import flash.display.StageScaleMode; import flash.events.Event; Notice the several “Stage...” imports. They are all used to set proper scaling and alignment. These are usually set in the constructor function: public function FlagFinland() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; stage.quality = StageQuality.MEDIUM; stage.addEventListener(Event.RESIZE, onResize); this.loaderInfo.addEventListener(Event.INIT, init); } There are two event listeners defined. The first one for resizing and the second to be run when the whole flash file has been loaded: private function init(evt:Event):void { drawFlag(); } private function onResize(evt:Event):void { drawFlag(); } Both of these call the same function, which in turn will do the drawing. That function and the complete package is available at http://paazio.nanbudo.fi/
  • 4. Actionscript 3 with FlashDevelop3 v1.0 : 14/11/2007 Jukka Paasonen 4(4) Compiling of the file is easy, just click on the “Build Current File” button on the toolbar, as shown in image 2. Image 2. Toolbar with the compile button hovered.