Having done some programming in Groovy, I know you can write test code in the Groovy console. I classify this as true a scripting language as it doesn't force you to have a class definition.
So I'd assume with a name like ActionScript with 'script' in it's name that, you can write a series of statements that act linearly, such as a sequence of variables assignments, their manipulation and dumping out a value.
My question is if this is possible, how do you go about doing it, in order to test some code with ActionScript3?
Does the code have to exist in a package?
Can the code exist on it's own? (If so, what would the name be you'd give to the source file in order to compile it from the command line?
Would you use mxmlc?
Would you use compc?
I've heard about fsch too. How about that?
I also read about a command called 'asc' in R.Braunstein's AS3 Bible 2nd ed (P8), but don't even see this in the SDK bin folders.... So what's that all about?
Assuming I've managed to compile this name.as file, how do I execute it and see results? Do I have to run it through a browser and the HTML template, or can I execute from a command line?
Do you have to have a class in the source to bypass this?
Can the code block be placed outside a dummy class?
If so, does it have to exist in a function?
Or can it exist on it's own?
Does it have to exist in a code blocks, by wrapping them in curly braces?
eval
removed in AS 3.0, this is not easy to do.3: Code may exist outside of the package, and not only in frames:
package {
public class Open
{
//can use Hidden class
}
}
//invisible for outer files
class Hidden {}
4: Code is compiled into swf or swc, entire project at time. SWF can be opened in Flash Player, although Flex applications will not work this way (and AIR apps need adl to run).
Overall, ActionScript is not so true script language as you might like. It is dynamic, but compiled and not really meant for interpretation.