Finding Actionscript within an FLA file. Ask Question Asked 9 years, 7 months ago. Active 2 years, 8 months ago. Viewed 10k times 8. I am dealing with a Flash file which has been created by a third party. It has a lot of folders and files in the library and I can't seem to find any ActionScript anywhere. Is there a simple way of finding the. Demo version will only process first 5 frames of a SWF and display up to 25 lines of each actionscript. (This 5 frame limitation includes any movie clips in the first 5 frames. Only first 5 frames of a movie clip will be processed.) Download ASV 3.0 Demo Now (736Kb).
Whenever possible, put your ActionScript® in a single location. Organizing your code in one place helps you edit projects more efficiently, because you can avoid searching in different places when you debug or modify the ActionScript. If you put code in a FLA file, put ActionScript on Frame 1 or Frame 2 in a layer called actions on the topmost layer in the Timeline. Alternatively, you might put all of your code in ActionScript files. Some Animate applications do not always put all code in a single place (in particular, ActionScript 2.0-based applications that use screens or behaviors).
You can usually put all your code in the same location (on a frame, or in ActionScript files), with the following advantages:
- Code is easy to find in a potentially complex sourcefile.
- Code is easy to debug.
Avoid attaching ActionScript to objectsin a FLA file, even in simple SWF files. (Only ActionScript 1.0and 2.0. can be attached to objects; ActionScript 3.0 cannot.) Attachingcode to an object means that you select a movie clip, component,or button instance; open the Actions panel; and add ActionScript usingthe on() or onClipEvent() handlerfunctions.
Attaching ActionScript code to objects is strongly discouragedfor the following reasons:
- It is difficult to locate, and the FLA files are difficultto edit.
- It is difficult to debug.
- ActionScript that is written on the timeline or in classesis more elegant and easier to build upon.
- It encourages poor coding style.
- The contrast between two styles of coding can be confusingto people learning ActionScript; it forces students and readersto learn different coding styles, additional syntax, and a poorand limited coding style.Avoid attaching ActionScript 2.0to a button called myButton_btn, which looks likethe following:on (release) { //do something }However, placing ActionScript 2.0 with the samepurpose on the timeline (which is encouraged), looks like the followingcode:myButton_btn.onRelease = function() { //do something };note: Different practices apply when using behaviors,which sometimes involves attaching code to objects.
More like this
Twitter™ and Facebook posts are not covered under the terms of Creative Commons.
Legal Notices | Online Privacy Policy
Before ActionScript and MXML code can be included in an AIR application, it must be compiled. If you use an Integrated Development Environment (IDE), such as Adobe Flash Builder or Adobe Flash Professional, the IDE handles compilation behind the scenes. However, you can also invoke the ActionScript compilers from the command line to create your SWF files when not using an IDE or when using a build script.
About the AIR command-line tools in the Flex SDK
Each of the command-line tools you use to create an Adobe AIR application calls the corresponding tool used to build applications:
- amxmlc calls mxmlc to compile application classes
- acompc calls compc to compile library and component classes
- aasdoc calls asdoc to generate documentation files from source code comments
The only difference between the Flex and the AIR versions of the utilities is that the AIR versions load the configuration options from the air-config.xml file instead of the flex-config.xml file.
The Flex SDK tools and their command-line options are fully described in the Flex documentation. The Flex SDK tools are described here at a basic level to help you get started and to point out the differences between building Flex applications and building AIR applications.
Compiler setup
You typically specify compilation options both on the command line and with one or more configuration files. The global Flex SDK configuration file contains default values that are used whenever the compilers are run. You can edit this file to suit your own development environment. There are two global Flex configuration files located in the frameworks directory of your Flex SDK installation. The air-config.xml file is used when you run the amxmlc compiler. This file configures the compiler for AIR by including the AIR libraries. The flex-config.xml file is used when you run mxmlc.
The default configuration values are suitable for discovering how Flex and AIR work, but when you embark on a full-scale project examine the available options more closely. You can supply project-specific values for the compiler options in a local configuration file that takes precedence over the global values for a given project.
Note: No compilation options are used specifically for AIR applications, but you must reference the AIR libraries when compiling an AIR application. Typically, these libraries are referenced in a project-level configuration file, in a file for a build tool such as Ant, or directly on the command line.
Compiling MXML and ActionScript source files for AIR
You can compile the Adobe® ActionScript® 3.0 and MXML assets of your AIR application with the command-line MXML compiler (amxmlc). (You do not need to compile HTML-based applications. To compile a SWF in Flash Professional, simply publish the movie to a SWF file.)
The basic command-line pattern for using amxmlc is:
where [compiler options] specifies the command-line options used to compile your AIR application.
The amxmlc command invokes the standard Flex mxmlc compiler with an additional parameter, +configname=air. This parameter instructs the compiler to use the air-config.xml file instead of the flex-config.xml file. Using amxmlc is otherwise identical to using mxmlc.
The compiler loads the air-config.xml configuration file specifying the AIR and Flex libraries typically required to compile an AIR application. You can also use a local, project-level configuration file to override or add additional options to the global configuration. Typically, the easiest way to create a local configuration file is to edit a copy of the global version. You can load the local file with the -load-config option:
-load-config=project-config.xml Overrides global options.
-load-config+=project-config.xml Adds additional values to those global options that take more than value, such as the -library-path option. Global options that only take a single value are overridden.
If you use a special naming convention for the local configuration file, the amxmlc compiler loads the local file automatically. For example, if the main MXML file is RunningMan.mxml, then name the local configuration file: RunningMan-config.xml. Now, to compile the application, you only have to type:
RunningMan-config.xml is loaded automatically since its filename matches that of the compiled MXML file.
amxmlc examples
The following examples demonstrate use of the amxmlc compiler. (Only the ActionScript and MXML assets of your application must be compiled.)
Compile an AIR MXML file:
Compile and set the output name:
Compile an AIR ActionScript file:
Specify a compiler configuration file:
Add additional options from another configuration file:
Add libraries on the command line (in addition to the libraries already in the configuration file):
Compile an AIR MXML file without using a configuration file (Win):
Compile an AIR MXML file without using a configuration file (Mac OS X or Linux):
Compile an AIR MXML file to use a runtime-shared library:
Compile an AIR MXML file to use an ANE (be sure to use ‑external‑library‑path for the ANE):
Compiling from Java (with the class path set to include mxmlc.jar):
The flexlib option identifies the location of your Flex SDK frameworks directory, enabling the compiler to locate the flex_config.xml file.
Compiling from Java (without the class path set):
To invoke the compiler using Apache Ant (the example uses a Java task to run mxmlc.jar):
Compiling an AIR component or code library (Flex)
Use the component compiler, acompc, to compile AIR libraries and independent components. The acompc component compiler behaves like the amxmlc compiler, with the following exceptions:
- You must specify which classes within the code base to include in the library or component.
- acompc does not look for a local configuration file automatically. To use a project configuration file, you must use the –load-config option.
The acompc command invokes the standard Flex compc component compiler, but loads its configuration options from the air-config.xml file instead of the flex-config.xml file.
Component compiler configuration file
Use a local configuration file to avoid typing (and perhaps incorrectly typing) the source path and class names on the command line. Add the -load-config option to the acompc command line to load the local configuration file.
The following example illustrates a configuration for building a library with two classes, ParticleManager and Particle, both in the package: com.adobe.samples.particles. The class files are located in the source/com/adobe/samples/particles folder.
To compile the library using the configuration file, named ParticleLib-config.xml, type:
To run the same command entirely on the command line, type:
(Type the entire command on one line, or use the line continuation character for your command shell.)
acompc examples
These examples assume that you are using a configuration file named myLib-config.xml.
Compile an AIR component or library:
Compile a runtime-shared library:
(Note, the folder lib must exist and be empty before running the command.)
Flex compilers