where to put library folders relative to ActionScript project in FlashBuilder? - apache-flex

If I create a new ActionScript project with Flash Builder and want to add some library (for example Tweenlite) where do I have to put the gs folder of Tweenlite relative to my project folder? and what do I need to setup in the project settings in order to be able to use it?

Doesn't matter, where to put your library folder. Just set the path to this folder at Project -> Properties -> Flex Build Path -> Library Path -> Add SWC Folder...(or Add SWC)

I would recommend that you create a new Library project named something like 'TweenLite' and dump the files in there. Then in Flash Builder go to:
Project -> Properties -> Flex Build Path -> Library path tab -> Add Project -> select the tweenlite project.
In this manner the project's source only gets compiled when it needs to be and the resulting swc is used by your application. You still get the benefits of the go-to source hotkey and can set breakpoints in the tweenlite project as well.
Cleaner, reusable, faster, it's how I do things.
*Ah also, multiple projects can reference the tweenlite library project now instead of having to copy & paste the code everywhere.

Related

Unable to add SWC file to Flex Library Build Path in Flash Builder

I'm looking at Flash Builder for my next project. I'm following some tutorials, yet I keep getting stuck at the same part. The tutorials I am following tell me to add a SWC files (containing my art) and should be in a library project.
I can create the library project and use it as a reference in my application. However, when I try to add the SWC file to the "Flex Library Build Path" the OK button does nothing. The same happens if I try to add a SWC or SWC Folder.
I' m using Flash Builder 4.6 (trial version) if that makes any difference. Below is a screenshot of the window that I am talking about in case I'm not very clear.
It has also happened to me.
There is workaround - just place SWC into /libs directory of your project and perform clean. SWCs there will be loaded automatically.
Make sure you have added the folder to the Workspace's linked resources. In Flash Builder, go to menu Windows > Preferences > General > Workspace > Linked Resources, and add a new path variable to the component directory. After this, the component can be added to the project's Flex Library path.
I think this is a bug of flash builder. It has also happened to me. And I can not choose the output path in fb....
I found a way, first, delete this project, delete evrey thing fb created itself except the source code, then u can swith ur fb to a new workspace, add creat a new project, u will see that u can add the swc file now.finally,switch back to the workspace u worked with before......

how to convert a mxml file to a compoent that i.e .swc file

hi i hav tried to covert .mxlml to .swc file using flex builder
it's not working when i integrate with other application...can any one say how to get .swc using SDK...pls i need very clearly
In Flex Builder (Or Flash Builder) you need to create a Flex Library project. Put that mxml file in the library project, right click and select "include in library" from the context menu.
The Flex Library project should generate a SWC with that class which you can then use in other proejcts by adding that SWC to the library path.
Flextras is right, but a little more clearly (since you haven't accepted it yet):
Within Flex Builder (I'm assuming Flex Builder 3, but it's probably the same in Flash Builder), go to File -> New -> Flex Library Project. Enter a name an click Finish. This creates your project.
Create (or copy) the files you wish to compile into the src folder in your new project. The trick is that when you copy a file to the src, it is NOT automatically included in the library's build, and hence it will NOT end up compiled in the resulting SWC.
To include these files in the library build, right click on the project in the Navigator panel and select Properties. Click on "Flex Library Build Path" on the left, and under the "Classes" tab on the right, click "Select All" (or check the boxes you wish to include manually).
Once your files are included in the library project's build path, simply build the project. The build should happen automatically, but you can go to the Project menu and select "Clean" to be sure. Ensure that your project compiles correctly (no compile errors), and a SWC file should be generated in the bin folder. Note that pretty much whenever you change anything within the project's file structure, you will probably need to repeat the step of clicking "Select All" in the library build path.

Actionscript classes to 1 SWC file

I'm using Flash Builder 4 (the version after Flex Builder 3, so very similar to Flex Builder 3) and have a bunch of actionscript classes that I frequently need to reference. I have them in a separate folder/package to keep things clean.
I know that it's possible to create a SWC from these actionscript files. My question is how do I do it in Flash Builder 4 or Flex Builder 3. Do I need other tools? My objective is just to use the SWC in the project and keep things clean instead of dragging around all these files.
Create a Flex Library project and put the code in the /src folder. Click on
project properties-> Flex Library Build Path -> Classes
to make sure all your classes are included.
You can set the 'Output folder' here to point to your main project /libs folder to have it automatically build into your project or just drag the .swc manually when it's created from your 'Output folder' to the 'libs' folder of your project. Hit the [OK] button and your .swc will be created. The code is now available in your main project.
In Flex Builder 3 you can right click the projects panel and choose New -> Flex Library Project. The steps to creating a project are very similar to creating a regular project. You just link the classes you want compiled into your SWC and tell Flex Builder where to put the compiled code.
other way is:
suppose you have a class Name MyCls which you want to compile into swc file.
create a Fla, and ctrl+shift+f12, check the publish item to SWC.
go to the action panel, type :
var v:MyCls;
finally, just compile this fla. it generate a swc which contains your MyCls;

Flex: Reuse classes for multiple projects without copy+paste?

OK I have a few classes I have made or found on the web that I plan to use in multiple projects, I would rather store these classes in a central location instead of copy+pasting them into each project.
my Flex projects have their own workspaces inside the path Flex/WorkSpaces/< workSpaceName >
If I wanted to put another folder inside the Flex directory and have the packages be com.mydomain.whatever
What folder structure would I need to make, and how would I make the code accessible to my projects?
Thanks!
You can import entire projects in FB3. Take a look at the documentation.
It is always better to use packages. Keep the src organized as follows:
com
|__ johnisaacks
|_____ utils
|_____ components
|____ video
|_____ assets
....
Go into the Project Properties, Choose Build Path. In the Source Path tab, you can add folders containing ActionScript files from anywhere on the file system. In the Library Path tab you can add individual SWCs or folders containing multiple SWCs.
An example (for Windows, but it should be similar on a Mac):
Let's say you have a folder C:/Development/classes where you keep all the "shared" source files that you reuse across projects. In that folder, you want to keep one of your classes, com.example.MyClass. You should use this folder structure:
C:/Development/classes/com/example/MyClass.as
What I would normally do is create a new library project and store those classes in that project.
To link that library project to your current project you would only have to add it to the library path of the current project (Project Properties -> Flex/ActionScript Build Path -> Library Path tab).

create .project file for flex application

I want to add my flex project to a SCM like Clearcase and then allow other developers download it and use in FlexBuilder.
What foramt do i need to place it in my clearcase so users can simply download and import into Flex Builder? Is there some way to create a .project file or similiar to allow Flex Recognise the project in clearcase?
I do not know Flex Builder project config files (I do know very well ClearCase though), but this question looks like "Do you keep your project files under version control ?" or "Which eclipse files belong under Version Control"
In essence, you should put any config file in ClearCase as long as you have relative path and/or variable for the other users to interpret.
A snapshot or dynamic ClearCase view will simply present those files for them to use, whatever they are. For instance, some eclipse .project or .classpath can be stored that way, while using linked directories.
So for Flex Builder project, one way to determine what file to store is to copy a minimal subset of those files in a new directory and check if you can re-open your project successfully.
Once the minimal set of file is determined, you can "add to source control" them.

Resources