Developing a Flex-free AS3 Project for Flash Player 10 in Flex Builder 3 May 29, 2010Posted by Tournas Dimitrios in Flex and PHP.
So you’re developing an ActionScript 3.0 project, without using Flash components or the Flex framework, aimed at Flash Player 10. You could do it in Flash authoring, or you could do it in a third party code editor. But, did you know you can also do this in Flex Builder?This tutorial aims to show you that Flex Builder is not just for Flex projects. It can be used for pure ActionScript 3.0 projects, without accidentally using any classes or features of the Flex framework, compiled and deployed for Flash Player 10.Maybe the reason you’re not already using Flex Builder for your ActionScript 3.0 projects is that you’re afraid you may accidentally use a Flex framework class and increase the file size of your application unnecessarily. But there is a way around this.
- Follow steps 1-8 in this tutorial for instructions on installing the Flex 3.5a SDK.If you already have the Flex 3.5a SDK installed globally by default through modifying the Flex Builder configuration files as per the tutorial on opensource.adobe.com, you can skip this step.If you’ve installed the Flex 3.5a SDK using the above tutorial, and you’ve since switched workspaces, you may need to configure the Flex 3.5a SDK for your other workspace. You can do this by saving the preferences of your original workspace and importing them into your new workspace, or you can go through the steps in the tutorial.When you’re done, come back to this page.
- Create a New ActionScript Project. For simplicity’s sake, make sure that the Flex 3.5a SDK is set to the default.Since we need access to more than just the Library path preferences, we’re going to edit the project preferences after we’ve created the project.
- Select the ActionScript project > right-click > Properties.
- Select ActionScript Build Path > Library path.
- Open the “Flex 3.5a (stable)” folder and select playerglobal.swc.If you’ve named your Flex 3.5a SDK slightly differently than in this example, that’s okay. You can even refer to a completely different version of the Flex SDK if you wish. We’re using the Flex 3.5a SDK to keep things simple, because this is the same SDK version which contains the FP10 SWC file.
- Click Remove to delete the playerglobal.swc entry.This removes the Flash Player 9 swc reference.
- Select Add SWC.
- Browse to the Flash Player 10 playerglobal.swc file, which on Windows is in C:\Program Files\Adobe\Flex Builder 3\sdks\3.5\frameworks\libs\player\10
- Under the new playerglobal.swc entry, select “Link Type: merged into code“, and click Edit.
- In the Link Type drop down menu, select External and press OK.
Now you should see External next to the link type entry. This tells the Flex compiler to refer to a playerglobal.swc which is not in the default location indicated in the configuration files, so you won’t get an error when attempting to compile.Next you need to tell the version detection in the wrapper to look for Flash player 10.
- Still in the Properties window, select ActionScript Compiler.
- Change the Required Flash Player version setting to 10.0.45, which is the current version of the Flash Player.
But we’re not quite done. We have to go back a step and ensure that we won’t be using the Flex framework in our project.
- Go back to ActionScript Build Path > Library path.
- Open the “Flex 3.5a (stable)” folder.
- Delete the flex.swc and utilities.swc entries . These refer to classes in the Flex framework: by deleting these, we can be assured that we’re not going to accidentally use them