Let's set ourselves the task of assembling HelloWorld.as using the Flex SDK without using a mouse. What for? At least to ensure that the idea that this technology is equal to the need to install Eclipse does not creep into the head of a user browsing the search results of the Habr at the request of Flex.
By cut, the solution to this problem, as well as bypassing some possible pitfalls.
There are a lot of flex, what to choose?
At the time of this writing, the Flex SDK
download page contains several versions of this product. Moreover, the latest version (which is most interesting to us) is divided into two editions - “Free Flex SDK” and “Open Source Flex SDK”. The first one is the most complete version, containing everything you need to build any Flex applications. The second option is for those who do not want to have on their machine any (albeit free) components with closed source code. Actually, the Open source Flex SDK is a Free Flex SDK minus closed components, including the Flash player, AIR, technology for advanced font encoding, and code that allows you to use things like data visualization components for commercial purposes.
It is necessary to download the Free Flex SDK, and at your leisure to deal with legal issues. They are covered
here .
Where to put all this good?
In your directory for various code and technology experiments, create a flex directory. In it, create another directory with the version number of the Flex SDK. Extract the contents of the archive with the SDK into it. In my case, it looked like this:
mkdir -p ~ / dev / flash / flex
cd ~ / dev / flash / flex
wget -c
fpdownload.adobe.com/pub/flex/sdk/builds/flex4/flex_sdk_4.1.0.16076.zipunzip -d 4.1 flex_sdk_4.1.0.16076.zip
For ease of future switching between SDK versions in the same directory, create a symbolic link to the current version.
ln -s 4.1 current
Add the path to the bin directory in the Flex SDK to the global variable PATH
echo "PATH = \ $ {PATH}: ~ / flash / flex / current / bin" >> ~ / .bashrc
Reboot the console (exit + login or close and reopen the terminal emulator)
And how to build Hello world?
If, with amendments to the rules of your distribution, everything went fine, then the Flex source code compiler mxmlc became available on the command line. You can run it and it will give something like:
Adobe Flex Compiler (mxmlc)
Version 4.1.0 build 16076
Copyright (c) 2004-2009 Adobe Systems, Inc. All rights reserved.
:
It remains to write the necessary code and compile it:
The code is placed in the HelloWorld.as file.
')
//
package {
// MovieClip,
import flash.display.*;
// ,
public class HelloWorld extends MovieClip{
function HelloWorld(){
//
trace("Hello World!");
}
}
}
We collect:
mxmlc -optimize = false -omit-trace-statements = false HelloWorld.as
Why everything is so you can read, for example, in the wonderful
book of Colin MookAnd where can I see the debug message?
Alas, this is not so simple. Firstly, only the debugger version of the flash player can display debug messages.
It can be found in the runtimes / player / 10.1 / lnx / flashplayerdebugger.tar.gz directory.
In addition, messages will be displayed only in the file ~ / .macromedia / Flash_Player / Logs / flashlog.txt and only if there is a mm.cfg file in your home directory with the following contents:
ErrorReportingEnable=1
TraceOutputFileEnable=1
And what follows from this?
And it follows exactly that we have the basis for experimenting with the ActionScript programming language and if this interests you, let us know and we will try to do something more complicated, for example, to destroy the wall of cubes using the Box2D physics engine or to build a cross-platform AIR application with a window of arbitrary shape.
PS In the process of writing this article, I managed to accidentally publish it in its infancy. I apologize.