How does the Gaia Flash Framework access the scaffold.as file? - actionscript-3

In the Gaia Flash Framework, a file called 'Scaffold.as' is used to make each page a scaffold page. This is accessed by the code,
new Scaffold(this);
But the class itself does not appear to be imported. Am I missing something about the way flash handles external classes? Or is there something else pulling it in?
Any help appreciated.

This all depends on how you are compiling. I'll assume you are using Flash IDE to compile. Flash has a source path lookup mechanism. This can be accesed through the fla (under File->Publish Settings->Flash (tab)->ActionScript). If the file Scaffold lives at the root level of a class path then there is no need to import it. The default class path includes the directory the Flash file resides in and some Adobe directories. There is a mechanism for managing class packages ... I think it was the old Macromedia Extension Manager. It would copy classes into the default class paths when the package was installed - so that could be the case. I have no familiarity with Gaia itself.
So there are 3 options. First the file Scaffold.as is in the same directory as your fla. Second the file Scaffold.as is in a default Adobe include directory. Finally the file is in a directory referenced in the fla's class path.

Related

How to open a Flash project with some existing code?

I am a Java developer and have no experience in Flash, so sorry in advance if some of my questions will look stupid :)
I got some source code in this hierarchy and structure:
-sources flash builder
-com
-greensock
-deng
-fzip
-utils
-org
-flintparticles
ALAccessibility.as
ALEvent.as
ALImage.as
ALVideo.as
ALVideoOld.as
Project.as
Project-app.xml
Folders are marked with - sign. I didn't write in details what is inside of every folder (they have a lot of .as files)
How to open these files and folders as a Flash (I don't know exactly as an Action Script or Flex or something else) project? I also have project.swf file.
I have the Adobe Flash Builder 4.7.
I think you might be doing the import one folder too "high".
Usually the file structures you posted here are within a /src directory which is inside a project directory. There should be an Eclipse project file (.project) in the folder you're targeting for the import.
I don't think it works any differently from importing a Java project into Eclipse.
If that's not available, you'll have to create a new project and copy everything you have into that project structure - it's possible you've lost some project config (build path, compiler settings, etc) if the raw source is all you have...
In Flash Builder. File -> Import Flash Builder Project. Select "Project Folder" and Browse to the folder. Follow any instructions that may appear afterward.

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 To Reconfigure Class File Paths In a FLA File?

I have a lot of library assets linked to external as3 classes. I would like to change the structure of the packages containing the linked classes, but if I do so, all links will get broken.
Is there any way to automatically or at least easily tell the FLA file where to get the new class files from? Could a FLA file be configured to read this sort of information from a configuration file?
You can add a folder to the source paths in ActionScript Settings. So if you had linked all your classes relative to the 'myClasses' folder, and then you moved everything to a different folder, you'd just have to update that one source path and it would find all the classes again.
Also, maybe this obvious, but I didn't realize it for a long time:
You can edit the class linkage right in the Library panel (without having to open the Properties for each symbol). Just double-click the linkage path.

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

How do I get the current filename of an AIR app?

I'm building an AIR app where some functionality depends on renaming the app executable in the filesystem, and detecting whatever name the executable has when it's launched. I don't need to detect changes while the app is running, if that makes any difference, and I don't need the path or extension — just the name.
If the executable was the only item in its folder, I could get the Application Directory from the File class and go from there. But it would be ideal to have a solution where there may be more than one copy of this AIR executable in a folder, each renamed to something unique.
I've looked at the NativeApplication class, the System class, the File class, and any other class that seems related to this issue, to no avail. The closest I've come is getting the Filename from the Application Descriptor XML, but that only reflects the default name the application is given when published.
So, how I can get the exact current filename of an AIR app at launch?
EDIT: To be more specific, on a Mac this executable would be the .app file, and on Windows this would be the .exe file.
EDIT2: loaderInfo.url won't work — it gives the name of the SWF file running within the AIR app, not the name of the containing AIR app/exe. If you're on a Mac, you can see this SWF file by opening the package contents of the AIR app, and looking in the Resources folder.
Use the following process:
Use the class XSLTProcessor, with HTMLLoader if necessary
Create an XSLT stylesheet which applied to the <filename> element
Apply it to the application descriptor file