简体   繁体   中英

hello world in actionscript on linux

I would like to write a simple "hello world" program for ActionScript (flash media server) and execute it on the command line of my linux desktop.

Something simple like:

HelloWorld = function() {
    trace( "Hello world" );
}

The purpose of this is so I can develop some simple functions and test them before adding them to larger existing Flash Media scripts.

Is this even possible? I just want to go to my command line and type something like:

actionscript helloworld.asc

and then tail a log somewhere to view the output. I really don't want to have to set up a flash media server and all that entails and download flash for a browser and go to some web address just to trigger the script...

Forget about Flash Media server, all you need is free Flex SDK you can download from Adobe.

Compile your own Hello World on Ubuntu: Flash/ActionScript3 “Programming” under Ubuntu .

or

A screencast going into a bit more details: Programming ActionScript 3 on Linux .

checkout redtamarin and as3shebang

redtamarin produce a command line runtime (redshell) to execute AS3 (compiled or not) it works for Linux, Mac OS X, and Windows in 32-bit and 64-bit

in a file "test.as"

trace( "hello world" );

either compile "test.as" to "test.abc" (abc is ActionScript ByteCode) or run "test.as" directly

$ ./redshell test.as 
$ ./redshell test.abc

another way is to install as3shebang, so you can directly run AS3 shell scripts

#!/usr/bin/as3shebang --

trace( "hello world" );

make it executable (chmod +x) and run it

$ ./test

few links:

If you just want the log, you can use the fdb command line tool [similar to gdb] (located in the bin folder of the Flex SDK you are working with).
You will still need some instance of an swf running to see the output. So you will either need the Standalone Flash debugger or the one in your browser.

Compile

mxmlc -debug=true hello.as

Debug

fdb hello.swf

From there you will see a trace ... in this case

[trace] Hello world

Add breakpoints to step through if you want or bunch up commands in a bash script. The full list of commands are in the docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM