Compiling as3 project to swc file in flashbuilder - actionscript-3

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

Related

How to create a library with shared code in ActionScript 3?

Say I want to create a library.swf file that will contain most of the definitions for images, sprites and (most importantly) code for custom components, that will be used by other sub projects by only linking the library.swf asset without actually importing anything in the resulting SWF file.
Here is the naive way I tried with Adobe Animate:
Create library project.
Create scripts needed.
Add scripts to project files without specifying main script of the main scene.
Expectedly, last step caused troubles because nowhere in the application I see a way to add scripts. The most promising is Library tab where I can add New Symbol..., but I would think I don't need to create MoveClip for every script I want to add.
In the meanwhile I was trying to find a way I could use this library in other projects, which I believe must be done by importing assets, but the same problem again - I can't find a way to import/reference some SWF file from which I can import packages.
Do I need some other IDE, say FlashDevelop, or is there a way inside Adobe Animate I totally missed?

Creating and Using a SWC File - Flash AS3

So I'm really confused on how to create, and use, a SWC file. I understand that a SWC file can be created to hold multiple assets. Basically, my code setup is the following:
c_Test.as - all testing of classes/fla files is done here
c_Test.fla - contains a few visual objects used/tested in c_Test.as
Class.as - class referenced multiple times in c_Test.as
Class1.fla - contains an important bitmap that is loaded into c_Test.as
So what I need to do is create a SWC file to be used in other projects; this is going to be the base of a multitude of other large projects, and I don't want to have to continuously copy and paste code into different folders. I am using Flash Builder 4.
So far, I went to publish settings in Flash CS6 in my c_Test.fla file and checked off Export SWF and Export SWC. What does this do? Has this created my SWC file?
I need to be able to access, from any random project, both Class.as, and Class1.fla.
Edit
So to clarify, cw_Test.fla is just a testing copy of the actual main fla file. I don't need this included in my swc. I just Exported my Class1.fla to SWf and SWC, and set a library path to the folder containing Class.as. Is this all I need to do to access both of these files from any project? (Besides importing them into any file I need them in).

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.

Flash Builder 4.7: How to force the compiler output the resulting swf in particular folder

We're developing a game and the project is well separated and structured. There are projects for different kind of things, such as UI, main-logic, gameplay, etc. Just how it's supposed to be.
Now, the main app project (that runs with Flash Player), uses a folder that is called assets.
I want one of the other projects (the Logic project) to be able to output in "assets/logic".
To do so I first tried (in the Logic project) with including the parameter -output in the compiler settings, but FB rejected it.
Then I tried to set the Output folder from ActionScript Library Build Path menu. I managed to set it to that folder, but it just outputs a SWC file, called just like the project is, and I just cannot force it to generate a swf file with a name I specify. That sucks.
Furthermore, I'd like to force the Logic project to compile itself and generate into that folder before the main project does, so that it includes that latest from the Logic project.
So how do I achieve these things?

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

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.