Running Flash (AS3) code in Haxe - actionscript-3

I am starting out developing in Haxe in combination with OpenFl, and am in a situation where I need to be able to run Flash/AS3 code in a Haxe program which is being compiled to Flash anyway.
I know I could use the command lime build -as3 as3source/ and then edit that code and manually insert the AS3 code I need to run, but I would prefer not doing that if I can.
Is there any way to do this?

You can compile your AS3 code into a separate swf or swc and then use -swf-lib to use it from Haxe.

You can always write a build script which enters the code in combination with the command for you, if you just want to avoid doing it manually, but I belive that´s the kind of answer you want.
I just find build script very usefull.

You may want to look at this article, some major options are described there (including tools for converting AS3 code to Haxe and technique with -swf-lib).

Related

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

Ventrilo hook read in Flash ActionScript 3

I would like to play a flash animation when someone talks in the VoIP program Ventrilo.
I have a simple animation setup within Adobe Flash and I would like to somehow trigger it when a specific person talks "keys-up" in Ventrilo.
I know the G15 keyboard can access Ventrilo remotely and display who is talking in real time so I think it should be possible to use this event to trigger a movie clip play command if I knew how to access it. I have looked for example code but can't find any.
I know this is probably a highly complex task but I'm sure there is a genius on Stackoverflow how knows how to do it or could at least set me on the right path.
Many thanks,
This is not going to be an easy task and is going to require writing a C/C++ ANE.
You can use Windows API hooking to intercept calls from Ventrilo.
http://www.gamedev.net/topic/387670-api-hooking/
http://www.codeproject.com/Articles/2082/API-hooking-revealed
You would need to write an ANE to use this inside your AIR app.
http://www.flexjunk.com/2011/11/30/developing-an-air-native-extension-for-osx-and-windows-in-c/

Flash ActionScript 3.0 - Any free compiler, tools and tutorials?

I have got an assignment in which I have to implement a AS3 wrapper for any FLV player and I have to expose actionscript functions (External Interfaces?) so that other can be used in other different applications via CallFunction API. I have few questions regarding this -
Are the tools for this are freely available? I know Flex SDK is but I want standalone swf (I means Flash Player 10) that can be used anywhere without any dependency and should contain FLV player embedded or should be able to load it from a particular location by supplying the URL.
Is it possible only with an ActionScript compiler (or any free tools?). My problem is that I don't have flash or flex builder and I don't want to spend money on these because I don't work on it.
As I have almost zero knowledge about it. Can you guys please explain me (if possible with details) that what I need to do. Any resoures on how to create and compile?
If any of you have ever done this it would be really great if you guys can share samples. I've heard that many people have done the same thing for video players.
I can share a bit of my setup
I use Flash (CS5) for creating assets
I use FlexSDK as the compiler
And do all the code in FlashDevelop
Flashdevelop is for PC only for now, it's free and comes since the last few versions now with a debugger
I use FlexSDK to compile and Eclipse with AS IDE or something along those lines, and then preview things in a web browser using an html page with the swf file embedded.
check out projectsprouts. its a pretty nice Flash (as2/3/Flex/AIR) generation tool that can help you stub out your project, compile it, and even create unit tests if you want. pretty simple ruby install (i am a ruby newb, and got is running pretty easily). It was a pretty good support base, and an active mailing list where people will be happy to help you along.
It is important to note that the FlexSDK has very little to do with Flex unless you are linking against classes that are Flex specific. mxmlc does not have anything to do with MXML even though it will also compile MXML.
Here is an article that describes Flash development on Linux. It is pretty old, but the principles are the same. With an Actionscript 3 Compiler (contained in the FlexSDK) and a text editor, you are off to the races. It is a lot easier with Flash Builder 4, FDT 4, Intellij IDEA, Flash Develop, etc ;)

Can we use compiled Haxe swf's swc's in Actionscript as normal libs?

Can we use compiled Haxe swf's swc's in Actionscript as normal libs? I have a swf compiled from haxe code (I can try to compile it into something else SWC for ex) I want to use it as lib in AS3.
Is it possible?
If yes how to do it?
Yes, you can, the performance increase is worth it, and it's surprisingly easy! I got 3-4X speed-up on both a simple sum-of-primes algorithm and a complex 2D bin packing algorithm.
I've posted an entire example project on github -- from Haxe source and compile scripts to usage in an AS3 project. Check it out: https://github.com/jcward/HaxeSWCExample
Update: Note that the 3-4X gains were on the desktop platform. Sadly on mobile platforms, the gains were much more modest.
Yes you can. If it is a library then you would want to export it as a SWC and then just make sure that where ever you are compiling from knows the path to the SWC.

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.