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.
Related
I am new to Flash and I need to edit some files that are used in a flash project. The files I need to edit are in actionscript. What is the relation to the file types .as(actionscript), .fla (flash?), and .swf Also, do I need to recompile after any changes I make to an actionscript file.
Most likely, the .fla file is the main project file (what ties everything together). The .swf files are likely the final output from said project file. The .as files are code files that are likely attached to various items in the .fla file.
Here is an example:
You create a project in FlashPro/AdobeAnimate, you import some graphics, animate them on a timeline, and then want to add some code to those graphics to make them do something dynamic, so you create a class file (.as) and write some code, then link that class file to a timeline or object in FlashPro. When you are all done, you publish your application. This creates a .swf file which is then used on the web (legacy) or loaded by another application (Adobe Air, Visual Studio etc.).
Now, .swf files can also be used by other .swf files when a program runs. So some assets like graphics (.png, gif, jpeg, .swf) could be used by the application at run-time. The .fla & the .as file(s) though are only used for authoring and are not needed for running the published application.
You DO need to re-publish your .fla after any changes to an Actionscript (.as) file - this will generate a new .swf 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
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.
I want to link external ActionScript file with my current fla project file so I can get the advantage of using classes in Adobe Flash professional CS6 in ActionScript 3.0.
But I am wondering if I can delete the AS file once the fla file has been published into swf?
Or even better would be if somebody could suggest me how to create classes in Flash CS6 without creating external files.
Thanks
When you publish a SWF file - all the source code (.as class files, library objects) are embedded into the SWF. (With the exceptions of Runtime Shared Libraries or any other assets you load at runtime).
This means that your SWF is not dependent on those .as files to run.
However, if you want to be able to re-publish or edit your project, you'll definitely need those .as files for that.
In regards to FlashPro, you cannot create class files that embedded in the .fla, they have to be separate .as files. You can however edit the .as class files in FlashPro.
I'm looking to make a library that can be either merged into a swf at compile time or loaded into a swf at runtime. The way I understand it, .swc files are generally merged into a swf at compile time, and .swf files are generally loaded into a swf at runtime. Is there a way I can have one file that can do both?
You could try using authortime shared libraries.
Basically you would have an FLA that has the shared animation in a MovieClip. You could build this clip separately as a SWF and use that for any files that need to load it at runtime.
Then, in any other projects that need the clip to be compiled in, you'll create a new MovieClip in that project and link it to the shared clip in the other FLA.
In the Symbol Properties, hit Browse at the bottom in the Source section and navigate to the FLA and then the shared clip. Tick 'Always update before publish'.
Now, if you make changes to shared clip, you'll recompile the SWF that gets loaded, and recompile any of the other projects that use that shared asset. They should automatically import the newest version when they get built.
What are you trying to do? What is the "library" supposed to do or provide? If it's an animation, you can drop it in the IDE and have it compiled in (as opposed to loaded at runtime). If it's code, it's nonsensical to load it at runtime.