Execution life cycle of MXML+actionScript files - actionscript-3

I know that When we compile a Java class then it will convert it into .class file and then through this .class file we have been able to run our code
Now I am new to Flex4 and ActionScript3 and I want to know what happened when I create a MXML file in flex builder and run it.Is MXML file first convert to .as file and the able to run or some other conversions happen?

Is MXML file first convert to .as file and the able to run or some other conversions happen?
Yes, the mxml compiler will convert MXML files into Actionscript classes. The mxml compiler generates a lot of code, which by default is not saved in your project. You can, however, add the -keep-generated-actionscript option (or just -keep) to the compiler options of your project you can see the generated code.
Here is a reference to the various compiler options. Right click your project in Flash Builder, select "Properties", and select "Flex Compiler" to see/edit the compiler options.

Related

Compile error Flash CC 1017

Hi all I am trying to modify some flash files provided as part of a training package supplied on a DVD.
The DVD contains the final training packages as well as all the source files.
I have opened one of the source FLA files in Flash CC and fixed some typos in the text, then republished the SWF.
When republishing I get two errors.
1 Symbol 'noteBtn1' 1017: The definition of base class RolloverCursor was not found.
2 , Line 1, Column 1 5000: The class 'RolloverCursor' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
I have looked at the noteBtn1 Symbol and cannot see any script attached to it ?
I have assumed that by simply hacking the original fla file all the correct paths and setting should be inherited from the FLA file.
If I try and run the resulting SWF file it doesn't initailise correctly leaving all the assets visible simultaneously.
The FLA file has a single scene in it with the first layer being a script layer.
There is only one frame in the scene
It has been a long time since I touched Flash so a little help would be gratefully appreciated !!
Regards
Gus
There must some Action Script along with it in a folder which you probably didn't copy along. This happened to me as well a lot of times. Just search for the folder containing the 'as' file of RolloverCursor.as (most probably) and make sure it is in the same folder as your flash file.
The original object in the Flash project causing the error was not used. I have removed it from the compile. This caused another error about a missing library
The missing library was a 3rd party actionscript library. This was then downloaded and installed in the same directory as the FLA file.
Import statements updated to reflect the correct package structure, the object has now compiled.
I still cannot see how to set the global class path in the Adobe CC 2014 version of Flash professional

Actionscript 3.0(Adobe Flash CS4) Loading external .as files without knowing name of .as file

I want to know how to load external class files(.as files) in actionscript but don't have to know the class file's name. Think of it like loading mods in minecraft with forge mod loader, it doesn't know the main class of the mod's file name, yet it successfully loads the mod. I want to know if something like this is possible in actionscript 3.0 because I feel like making a tower defense game that isn't like the others out there but have it so it can be modded and have mods loaded but of course I have to load the class file without knowing the class file's name.
Note: I don't got access to Adobe Air so I can't use anything that requires Adobe Air.
You want to load a particular .as file AFTER or BEFORE compilation? After the compilation it is hardly possible - the file would not be compiled and therefore it would be useless. Why don't you use a swf or some kind of XML/JSON with settings in that case? Before the compilation you would still need to identify it by it's package name/name.
Basically, you want a plugin management system.
In AS3, it is not possible to "load" a .as file on execution, because it is a (uncompiled) source file. But, it is possible to load another swf and to use the classes within it.
Your process should probably be something like this :
Get a list of the plugins/addons. If you were using AIR, it would have been possible by browsing the content of a folder. Since you're not, you'll probably need to use a listing file (basically, a file that say "Here's the list&path of the plugins you need to load".
Load each swf file
(possibly) call a initialization method for each plugin.
You may wish to look into the way OSMF manages plugins, for example : http://osmf.org/dev/osmf/OtherPDFs/osmf_plugin_dev_guide.pdf

How can IntelliJ and Flash symbol library work together?

If I'm using IntelliJ Idea as my IDE for code that's being used by an fla that I'm compiling with Flash, is there a way I can tell IntelliJ what objects exist in the symbol that I'm writing a class file for so it doesn't treat references to these objects as undefined?
Example:
I have a Flash project in Flash CS5 with a MovieClip in the library which is linked to MyClass, an external class file. The MovieClip has a TextField named myTextField.
When I edit the class file in IntelliJ, it complains about references to myTextField because it has no way of knowing about it.
Is there a way to clue in IntelliJ? Can I just declare myTextField in the class file, or will that interfere with the instance that's already in the MovieClip?
You need to set your FLA publish settings to allow you to declare your instances in your class files. Try this:
http://www.wastedpotential.com/flash-as3-stop-using-automatically-declare-stage-instances/
If you follow these steps, you can declare your instances as properties in your classes. Your FLA will compile and IntelliJ will stop choking on them.

Compiling as3 project to swc file in flashbuilder

i have a question and i'm hoping to find an answer here,
i created a flashbuilder project that contains some classes with functions that i use often,
i have around 6 classes, would it be possible to compile these classes to a swc file so i just have to add the swc in a new project to access them?
Or isnt it possible to create swc's with flashbuilder?
Maybe i could do it in flash but dont have any idea how to compile multiple classes into 1 swc. file.
Sorry if this is a stupid question but ive never used it before and couldnt find much about is.
Inside FlashBuilder create a new "Flex Library Project".
It will take you through a new project wizard that is similar to an Actionscript Project. Once it is created, you can add your .AS classes to the source folder. As long as Project->Build Automatically is checked, it will automatically create (and update) a SWC file in your designated output folder, usually (/bin).
If you want to pick and choose particular classes or include external libraries, SWFs, or other SWCs, select Project->Properties->Flex Library Build Path there is a tab called "Classes" where you can select which classes you want exported into the SWC.
You can just create a library project for this.
Move all of your code into this project and build the project.
The output will be a .swc file in the bin directory.
You can also do this from the command line using the compc (short for component compiler) and incorporate it into an ANT task or a Maven build.
Cheers

Flash directories

Is it possible to make code in actionscript-3 to parse the virtual directories that are constructed in the flash library?
I mean that if i add a folder on the library of CS4 called 'graphics' can i write code that parse the elements of that folder in order to fill an array with folder's elements(which are BitmapData classes) ?
No, not as far as I know.
One way of looking at it is that the library is part of the fla file, the source document, and not of the compiled swf. Assets in the library that are not "exported for ActionScript" are not included in the swf. ActionScript doesn't have access to the library as such, there is no object in ActionScript for it.