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
 
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
 
Another Test
Another TestAnother Test
Another Test
 
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

WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPTiSEO AI
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 

Recently uploaded (20)

WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 

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.