Skip to content
BaconGobbler edited this page Apr 4, 2013 · 6 revisions

In this tutorial you will learn how to make a flixel project using Xcode.
The resulting project is what you get by using flx.py , but ready to be used in Xcode.
I assume you already have Flixel and Flex installed.

1 – Download the template
Download

2 – Install the template
extract the archive and put it in

/Developer/Library/Xcode/Project Templates/Other

3 – Set the path to mxmlc

  • Open the template by double clicking the “Template.xcodeproj” file
  • In Targets, double-click “mxmlc”
  • write the path to your flex sdk directory in the “Build Tool” field
    By default I set it to
    /usr/local/flex_sdk_3.4/bin/mxmlc

    If you have it in a different place change it to your location.

4 – Add Flixel

  • right-click your project in the side bar and selec “add → Existing Files…”
  • Select the “org” folder of flixel and click add.
  • Check the “Copy items into desitnation group’s folder (if needed)” checkbox.
  • Also select “Create Folder References for any added folder”
  • Close this project

5 – Create your project
Now that we have the template setup, it’s time to create a project.

  • click “File → New Project” or cmd-shift-n
  • give a name to your project and put it where you want

6 – Adapt the code to your project’s name

  • Rename “Template.as” to the name of your project
  • In the renamed file, change the two “PROJECT_NAME” to the name you just gave to the file.
  • Open “Preloader.as” and do the same thing
  • Double-click mxmlc under “Targets” go under “Custom Build Command” → “Arguments” in the right column and replace “$(PROJECT_NAME)” with your project name.

7 – Build
It’s finally time to build!

  • click “Build → Build” or just press cmd-b
    If there are no errors, you should now have a swf file in your projects folder.

Optional — If you would like to be able to launch your game’s swf with XCode’s built-in Run feature, follow these steps in your project:

  • Right click on “Executables”, select “Add” and select “New Custom Executable”.
  • In the following window, for Executable Name, rename “Executable” to “open”. Set the Executable Path to “/usr/bin/open”
  • In the Executable Info window, set the Path Type to Absolute Path, and then select the Arguments pane. Click the + in the Arguments section to add an argument.
  • Set the argument to: “/The Full Path to your Project Directory/YourGameName.swf”

Now you will be able to use XCode’s Run feature (Cmd-R) to build and launch your executable. Make sure you have Adobe’s standalone Flash Player installed and set to open .swf files.