Using FlashDevelop

Previous Next Print

YouTube

http://www.youtube.com/watch?v=V_g4RqO0ML8

This video is part 1 of 2 that show the basics of Flash with ElectroServer. But it starts off by showing how to set up a Flash Develop project that works with ElectroServer.

Before you read

  • Download and install the latest FlashDevelop
  • Download the Flex SDK

Overview

While any IDE can be used to author ElectroServer applications, most of the ActionScript examples provided on this site or with the ElectroServer installation were authored using FlashDevelop. Below you will learn how to open a project, create a new project, and add the ElectroServer SWC to the classpath.

 

Opening an existing project

To open an existing project simply double-click on the project file. The project file name contains the name of the project with a *.as3proj extension. For example: Connect and Login.as3proj

 

Once opened you can author code and modify compile settings (such as frame rate and application dimensions). Any project can be compiled simply by pressing control + enter or F5.

 

Most projects contain at least three directories:

  • src - This contains the source *.as or .mxml files.
  • lib - This contains SWC files (if needed).
  • bin - This is where the application is compiled to.

Creating a new project

When authoring ElectroServer applications using ActionScript 3 you will likely create one of three types of projects:

  • AS3 Project - A project compiled straight from ActionScript. There is no MXML and no FLA file.
  • Flex 3 (or 4) Project - A project compiled against at least one MXML file. This uses the Flex Framework to provide pre-built UI control.
  • Flash IDE Project - In this type of project FlashDevelop is used only to author the code, and the Flash IDE is used to compile a FLA that uses that code

To create a new project in FlashDevelop:

  • Select Project > New Project
  • Select the project type
  • Give the project a name
  • Select the location to create the project
  • Click OK

This will create a project file, bin folder (for the compiled application), a lib folder (for SWCs), and a src folder (for the code). If it is an AS3 Project then a Main.as file is created in the src directory. If it is a Flex project then a Main.mxml file is created in the src directory.

 

Adding ElectroServer.SWC to the classpath

To gain access to the ElectroServer API, add ElectroServer.swc to the project's classpath. The SWC can be found in the [installation folder]apis/client/as3/dist.

 

The easiest way to add to the classpath in FlashDevelop is to copy the SWC file directly into the lib folder found in the project directory that you created. Then, in the project view right-click on the SWC and chose 'Add to Library'.

usingFD1

Now that the SWC is in the project's classpath, you will get code help when using the API.

usingFD2

Viewing trace output

Depending on what you already had installed before installing this IDE, FlashDevelop might use the non-debug version of the standalone player when testing your application. The application will work just fine, but FlashDevelop will not capture the trace output and runtime errors will not be shown. You can tell if you are running the debug player by compiling to test an application, and then right-clicking on it. It should look like this.

usingFD3

If you do not see the word 'debug' anywhere in your context menu like in the image above, then you'll need to download the appropriate player and associate it with FlashDevelop. To do that,

  • Go here http://www.adobe.com/support/flashplayer/downloads.html
  • Click on 'Download the Windows Flash Player 10.1 Projector content debugger'

Put the file wherever you want and then tell FlashDevelop where to find it. To do that,

  • Select Tools > Program Settings
  • Select FlashViewer in the list on the left
  • Enter the path to the file in the External Player Path field

 

usingFD4