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.
Related
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).
So I'm trying to build a separate package. In that package I would like to reference TweenMax, however I'm having trouble linking to it (error Definition com.greensock:TweenMax could not be found).
Here is my dir structure:
myApp
--com
----greensock
------Tweenmax etc
----myPackage
------packageClass.as
--------elements
----------elementClass.as (this is the one trying to access tweenmax)
--src
----Main.as
main.as is the document class, just so I can test myPackage. Doesn't do anything except instantiate myPackageClass and stick it in the displayList.
In the elementClass.as I have:
import com.greensock.TweenMax;
which flashDevelop seems to see within the ide, but when I compile I get the ...could not be found error.
So how can I reference tweenmax from my elementClass file (I have src and com dirs in the classpaths.
I'm using flashDevelop with flash player 11.7 and Flex 4.6.0 SDK.
Am I going about this all wrong?
I'm going to ask the hopefully obvious question, did you import the greensock folder?
import com.greensock.TweenMax
Ok let's say you did that already. Maybe you need to tell your code where your libraries are. Go to File > ActionScript Settings, or, on the stage's property panel, click the wrench icon next to the Script drop down menu.
You should see a dialog with three tabs, the first two of which are labeled Source path and Library Path. Forget about the third.
In the Source path tab, you should at least have a dot - (.) - as one of the choices. That tells flash to look for any actionscript classes it can't find at compile time in the same directory as the source FLA. From there you can list any number of other library paths that contain supporting files.
The second tab is for SWC files. If you have a SWC library, you can tell your FLA where to find it by pathing to it here, just as you pathed to your libraries in the Source path tab.
The images below presume that there is a folder, in the same directory as the source FLA, named library. In this folder are sub folders named src and swc. Inside src are sub folders containing the greensock and facebookAPI com folders, (the latter used here for example). Inside the swc folder there is a SWC named exampleSWC.swc.
The paths shown in the pics below would allow the FLA to see the following imports:
import com.greensock.TweenMax;
import com.facebook.someFacebookAPIClass;
import com.somePackageInTheSWC.someClassFromExampleSWC;
I have all of my files in version control (SVN subversion). FLA file is not a text file, so when I change it and check it in, there isn't a way to see what has changed inside of FLA.
Is there a way to keep track of changes to FLA file and it's contents?
Flash CS5 has introduced a new file format called XFL which has been designed for use with version control systems. This format basically splits up your FLA file into a series of separate XML data files (all contained within the one folder) which means version control systems can accurately determine what parts of the file have changed.
Simply go to File > Save AS, and select xfl from the drop-down list.
If you're using anything before CS5, then unfortunately there is no similar way to accomplish this task. I will add, however, that if this is the case, then you can try and mitigate this problem by keeping all your code in an external AS file and load any data from external xml/image/etc. files. This way, there is at least some degree of tracking for certain parts of your project.
I have a process set up to create action script files. They hold functions that are called upon by my flash project. How can i reference these files so that the project knows the functions are there.
with asp.net i would simply reference the .js file. Is it the same process?
The process of importing files to be used by Flash is pretty straightforward:
At the top of each external file there will be a package declaration, it basically represents it's path from the .fla file.
For example:
package com.site.objects
The above represents an ActionScript file within a folder objects, within site, within com whose parent folder also contains the .fla file.
When you're importing external files, you always start from the directory containing the .fla. This is always necessary with the exception of importing external files that are in the same directory as the file you're trying to access the class from.
The import statement for the above example will look like this:
import com.site.objects.MyClass;
Once you've done this, you'll be able to:
Create instances of the imported class.
Access static properties and methods defined within the class.
Extend the class to create a new class which will inherit it's properties.
etc
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.