views:

907

answers:

3

Is there an easy way of converting a Actionscript 3 project to a Flex project in Flex Builder? When i right click on the project and hover "Flex Project Nature", all options are greyed out

+2  A: 

I haven't seen anything like that in FB3.

An AS3 project will lack quite a few of Flex project settings (e.g. template html). You are best served by creating an empty Flex project and adding the AS3 source to it -- drag and drop the folder(s) in the src folder of the Flex project. Alternatively, if it is a SWC you can add it using project settings.

dirkgently
+1  A: 

It's a little dirty, but it works.

  1. Delete the project in Flex Builder's Navigator.
  2. It will ask if you want to delete the files from the file system too. Keep them.
  3. Create a new Flex project in the same directory as the ActionScript project.

The old files will be unchanged, but the new project will have the Flex Project nature. If a file already exists that has the same name as a file that the project wizard wants to create, the existing file will be not be deleted.

If you have custom command line arguments, source or library directories, or any other project-specific settings, you may have to reset them.

Just in case something goes wrong, be sure to back up your project directory first. I've never lost files when I've recreated a Flex Builder project, though.

joshtynjala
+2  A: 

A few general steps to get there without losing your project settings:

  • change your navigator filter to show all the files it's normally hiding from you.
  • look for a .project file at the root of your project. You'll see a <natures> tag in there.
  • create a new Flex project. open the .project file there, and compare the <natures> node.
  • copy the missing stuff to your current .project file.
  • you may need to close the project and reopen it, to nudge Flex Builder to parse your modified .project file
  • you'll probably have to click around the project properties to get things just right. At least under Flex Build Path -> Library Path, click on the "Add Flex SDK" button, since that's probably why you want to do this in the first place.

If you're missing the templates/ stuff (not a big fan myself, but it's a nice crutch when you're just starting a project), go mess with one of the form fields under "HTML wrapper" under "Actionscript Compiler" in your project properties and apply the change, and the IDE will recreate the templates/ folder.

Metal