April 3rd, 2007 by Kyle
Posted in: Flex, Flex Builder
Here is an example demonstrating how to use project references to refer to source files in other projects as well as swcs in other projects.
If you take a look at this zip file, you will find that it contains 3 projects.
The first project is a normal Flex project called globalIncludes which contains an actionscript file, vars.as.
A second project, Expando, is a library project, which contains an mxml component.
- In the properties/Project References dialogue for this project there is a checked refererence to the globalIncludes project.
- In the properties/sourcepath for this project, I have added the root folder from the globalIncludes project. (Just click the add Folder… button and navigate to the folder.) This folder is added as ${DOCUMENTS}\globalIncludes.
Now in your Expando project you can see a “virtual directory” from the globalIncludes project labeled - [source path] globalIncludes.
In my mxml component in the Expando project, I refer to the actionscript file from the globalIncludes project by doing an include:
Then in my component I use a variable defined in that vars,as actionscript file to expose a version number tooltip in my component.
Note:
In the Expando project, I have right clicked on the ExpandoComboBox.mxml and selected – “Include class in library”. That way, whenever I make changes to this component, the swc will be recompiled.
My third project, Sample, is a normal project that just has an application in it.
- In the properties/Project References dialogue for this project there is a checked refererence to the Expando project.
- In the properties/Flex Build Path/Library Path dialogue for this project, I have added the Expando Project (click Add Project… and you will be able to select the Expando project since it is in the list of Project references.)
Now you can launch the Sample.mxml application and see that the tooltip for the ExpandoComboBox is 1.0 which has come from the vars.as actionscript file in the globalIncludes project.





April 4th, 2007 at 7:01 am
I can not seem to find the link to the zip file.
April 4th, 2007 at 8:06 am
Sorry. I forgot to add the link. It is fixed now.