ActionScript 3 as a console app? - actionscript-3

Is it possible to have actionscript 3 as a console app? I want to play around with the language and do basic things like hello world and inheritances or file IO if thats allowed. Is there a REPL or a compiler (that will allow me to write a console app) for actionscript 3?

If you're serious about command line as3 you should have a look at redtamarin, based off the Mozilla Tamarin project:
http://code.google.com/p/redtamarin/
Though I think the complexity of building the tools might defeat the purpose of a "hello world" situation? Depends if you're looking for proper command line tools or just experimentation.

Related

Is there any way to run two instances of flash professional debug

After already searching the site for the answer to the question, I've found this:
Is it any way to run two instances of debuggers?
I need the Flash Professional CS5.5 version of the answer to this question.
Basically - I need to know if there's a way to debug 2 different .fla files in Adobe Flash Professional CS5.5 at the same time. One of them implements the Adobe AIR framework (for using the SocketServer class), the other is a standard AS3 project. It'd be nice if I could debug the client-server interaction easily using the IDE rather than using extensive means to do so.
Anyone have any ideas? Thanks.
This is not an answer to your question but a suggestion to take a different approach.
The Flash IDE and it's debugger are inadequate but for most trivial programs. Variable inspection and breakpoints work randomly and it's next to impossible to drill down into more complex objects. Flash IDE is all right for creating the visual resources for Flash programs but for any serious coding, it just falls on its face. The compiler included with the Flash IDE is also very poorly written and generates unoptimized code.
I'd suggest to switch over to using FlashDevelop - it's a free, open source IDE that runs on top of the Flex and Air SDKs and uses a better compiler that performs more optimizations. (You can mark functions for inlining, etc.) The debugger - while not Visual Studio - is much, much better than the IDE: breakpoints work and object properties can be inspected easily.
Because FlashDevelop is geared towards coding, you can create a project in it with multiple source files, define your resources and then compile to multiple platforms. Compilation is usually fast with hundreds of source files (don't import every type in every package) and you can do debug/release builds. If you can port your code from Flash to FlashDevelop, you'll have a much easier time managing your project.

Standalone actionscript interpreter?

I want to to play around with Actionscript, mostly to compare the language with Javascript (I'm interested in the type system). Is there a straightforward way to do that or do I need to also install Flash or something similar? I'd prefer something that works on Linux but Windows-only is fine too.
Basically, I want to know if there is something for Actionscript that is analogous to v8/NodeJS or Rhino for Javascript, where you can run JS scripts directly (using console.log for output) without having to use a browser, create an HTML page, etc.
There is an amazing online tool capable of compiling Actionscript 3.0, this will aid your investigation of the language!
http://wonderfl.net/
As3Eval also is a good tool. Play around with the demo to get a feel for it.
It's windows only, but download Java, then install FlashDevelop : http://www.flashdevelop.org/
It'll download the flex sdk and everything you'll need to get started.
You'll need flash player to see your tests, and normally the debug player (take the standalone), which you can download here: http://www.adobe.com/support/flash player/downloads.html
As #neil says, you can also use wonderfl to test directly online, though obviously the experience won't be the same as a full ide.
You should be able to develop on Linux directly if you want to install flash builder (eclipse) but it's not free

Alternative to using Flash Projector as Autorun Interface?

I have been given the task of creating an Autorun installer for a distributable CD, and thought I would challenge the task with Flash. In previous versions of flash it was possible to use fscommand and trickery to run other local exe files, but due to virus creators and what-not, this has been reworked and totally destroyed for others to use.
So as a Flash developer I have hit a bit of a brick wall with this, and am asking out for any alternative ideas anybody may have? I am quite open with learning new languages/programs, and would like any expert advice from people in the know.
Just as a heads up for what features are required:
GUI with simple graphics/buttons
Ability to launch external exe/pdf files
must be able to be compiled to an exe, which can be launched by any windows machine without installing third party software eg Java.
The only simple solution I have thought of is making an html page, but using a browser is something I want to avoid doing!
Please Help :)
Christian
You can continue using flash freely if you want. There is a bunch of projector tools like northcode swf studion, Zink, mProjector and others. You can also create your own tool using any system programing language that produces windows executable - the only thing you will need - is to create an ActiveX instance of Flash Player and set up minimalistic API to allow Flash call required system functions.

A way to create command line program with Air 2?

Is there any way to create an Air 2 program that runs just in the command line? (no windows, no gui, etc)
Something similar to Windows Ping program. It would accept arguments and then output std out.
No, AIR is not really meant for creating command-line applications - it's just not the right tool for the job.
You would be better off looking at implementing your application in Java, C#/VB.NET, Python or Groovy (and innumerable other more suitable languages).
If you really have your heart set on Actionscript/Javascript-style syntax then you should look into Haxe.
You might want to check out CommandProxy as a possible solution.

Interactive ActionScript interpreter?

Is there some sort of interactive ActionScript interpreter? Similar to Firebug's JavaScript command line or Python's interactive shell?
Try AS3Eval Library - it is AS3 compiler implemented in AS3. It has simple interactive shell.
There's also Frontal:
http://code.google.com/p/frontal/
It has an ActionScript interpreter built into it. It's based on the ECMA 2.62 (JavaScript) standard so it's not full AS3 and doesn't support things like packages and classes but it's still extremely handy.
As I mentioned, the interpreter is part of a larger library implementing the Frontal language but if you were so inclined you could pretty easily just rip out the interpreter.
Or you could just use it in Frontal. And if you did then you do get a console that allows you to run ActionScript in a primitive shell. For example, go to the Frontal website. (I can't post the link because my reputation is low but it's frontalcode + com.) Right-click and choose "View Frontal Source..." This will open the Frontal console. At the bottom of the console, click "command line." This is your "shell."
Try something like this say:
5 + 4 * 10
or
movie.alpha = 0.5
Actionscript is a compiled language and the compiled byte code is executed by the Flash Player Virtual Machine. There are a number of tools out there that will create Actionscript byte code based on Actionscript source code. I'm not aware of the existance of any tools that will intrepet AS byte code and execute it other than Adobe Flash Player.
Although I do not say it's not possible, I haven't seen nor heard of any tools that gives you an interactive shell for Actionscript.
flash-console project does exactly that. They have a demo and an online help.
Special commands start by a slash like /help
Variables can be stored and accessed via $some_name
/ changes current scope to the last returned value.
The project is meant to be integrated in your project.