This document aims to help you set up FlashDevelop to use with Starling for desktop and mobile development.
Edit
buttons and write away.
Go to: “Tools → Program Settings… → AS3 Content → Installed Flex SDK's (hit the square to the right of this with the 3 dots in it) → Add → Path (again, in the square) and point it to your SDK.
starling/src
within the Starling download/Git folder. (recommended)lib
folder in your project and copy starling.swc
into it; then go to “Project → Properties → Compiler Options → SWC Libraries” and add the entry lib/starling.swc
.
Open the file application.xml
that's part of your project.
You need to make sure about two things:
xmlns
must point to the same AIR version that you installed via “AppMan”. The sample below shows the value for “AIR 24”.renderMode
is set to direct
. That's required so that Starling may use Stage3D.<application xmlns="http://ns.adobe.com/air/application/24.0"> <initialWindow> <!-- ... --> <renderMode>direct</renderMode> </initialWindow>
-swf-version=35
This batch file is executed when you hit “Test Project” (F5).
:target
controls how you want to launch/debug your application. For example, :desktop
controls the screen resolution used in the adb debugger.Any mobile project setup with FlashDevelop will contain a file AIR_iOS_readme.txt. It contains detailed informations about how to work with iOS. Follow these instructions!
Any mobile project setup with FlashDevelop will contain a file AIR_Android_readme.txt. It contains detailed informations about how to work with Android. Follow these instructions!
FlashDevelop helps insert import
statements in several ways.
When declaring something, if the class import hasn't been added yet, code completion will present a list of possible imports. Using arrow keys to select one and hitting enter will add the import code.
The other way is to place the cursor on the class name and press “CTRL + SHIFT + 1”. For example, if you were to write:
var bytes:ByteArray
Drop the cursor on ByteArray and try pressing “CTRL + SHIFT + 1”. That's if FlashDevelop doesn't automatically add the import (which it should if you complete the line with a semi-colon).
If the import hasn't been added, it will be added immediately, or a list will be presented with options if multiple classes with the same name are found (common when using Starling).
“CTRL + SHIFT + 1” is FlashDevelop's “Code Generator” shortcut, a super handy shortcut that does all sorts of wonderful things depending on the context where it's used.
You will want to add files to an AIR project so that they are bundled with the application (allowing you to load them at runtime). In FlashDevelop, that happens with all the files found in the bin
directory.
However, you probably don't want to place your assets in that folder – the bin folder is normally supposed to only contain files that are generated in the build-process.
Instead, I recommend you modify the file RunApp.bat
so that it automatically clears all contents of the bin
folder and then repopulates it with the contents of the assets
folder (that's where you would put your assets).
bat/RunApp.bat
and find the line that says:set PAUSE_ERRORS=1
:: Clear bin folder and copy over assets to be packaged. for /D %%p IN ("bin\*.*") DO rmdir "%%p" /s /q xcopy "assets" "bin" /s /c /y /i /q
When I start the debug launcher, it says:error while loading initial content
You probably forgot to update application.xml
so that it points to the same XML schema version as the AIR SDK you're using. Open it up and change the version number at the end of the application
XML tag.