the blog
Back to -Blog

Flex 3 and 4 Libraries - latest Amethyst Edge Release

Latest interim build of the Amethyst IDE now available
by Huw Collingbourne
Monday 10 May 2010.

The latest edge release of Amethyst (version 0.902) has improved support for the creation of library projects, support for the new Flash 10.1 player for debugging and a variety of improvements to MXML and ActionScript IntelliSense for Flex 3 and Flex 4.

Support for separately compiled libraries is significantly enhanced in the latest edge release of Amethyst

This edge release is only available for Visual Studio 2008. If you want to test Amethyst in Visual Studio 2010, please use the previous edge release. Later builds will bring the VS2008 and 2010 editions closer to parity. Note that edge releases are interim builds which are used to introduce new features and are likely to be less well tested than full betas.

Links to this edge release and to the last full beta for Visual Studio 2008 are found in the forum. If you have questions or comments on these edge and beta releases, please post these in the Amethyst section of the forum.

Known issues in this release:

- The default path to the Amethyst Flash Player (an alternative debug-enabled player in case you don’t have the standard Flash debug player installed) is incorrect.

If you plan to use this player, set the correct path globally (for all future Amethyst projects) in Tools/Options/Project and Solutions/Amethyst. Browse to the Flex/FlashPlayer. Assuming you have installed in the default location, the correct path will be: C:\Program Files\SapphireSteel Software\Amethyst 2008\VS2008\Player\AmethystPlayer.exe

- Auto-imports (added when a class is selected from a completion list) may be placed in the wrong place in a Library project. Fix: cut and paste them to the correct place (e.g. under the opening brace of the ‘package’).

How to import or convert Flex 3 projects for use with the Flex 4 SDK

If you are using the Flex 4 SDK, your Amethyst projects will require a different set of ‘references’ than are required by Flex 3. So, start the Project Importer Wizard (File/New/Amethyst Project Importer) and select either Convert In Original Location or Import to new Location (see HERE for an overview of the Project Importer). In the ‘Select Options’ page of the importer, be sure to check off ‘Flex 4 Framework’. When imported, right-click the ’main’ MXML file in the Solution Explorer and select ‘Set as Main’. Now you may be ready to run or debug the application in the normal way.

  • If errors are shown when you attempt to build, these may be due to incompatibilities between Flex 4 and Flex 3. Try setting the Flex 3 compatibility mode compiler option in Project/Properties/Compiler.
  • If you are importing a Flex Builder project, you may have imported some compiler options that are not required. Check the in Project Properties/Compiler page. For example, you may have imported an ’additional compiler argument’ such as -locale en_US. Either resolve the references to satisfy the compiler settings or delete or modify the compiler settings then attempt to rebuild.
  • Incorrect references If any references are missing these will be shown with a yellow ‘!’ in the Solution Explorer references. Delete the missing node and right-click to browse to add a reference to the correct SWC file. For example, the Flex 4 SDK places playerglobal.swc under the \player\10.0\ directory whereas Flex 3 uses the \player\10\ directory.

How To Switch SDKs

If you need to use a different SDK from your default for a specific project you may set this in Project/Properties/Application. Click Flex SDK Directory/Use Alternate. You will be prompted to allow the system to close and reopen the project. This is required to make the appropriate changes.

How To Create and Test a Library Project

Amethyst lets you select from a variety of project types

The essential steps are as follows (here I’m assuming you want to create a pair of projects - a Library and an application in which to test it):
- Create a Flex 3 or Flex 4 application (File/New/Project).
- Right-click solution node in Solution Explorer. Select Add/New Project
- Create a Flex 3 or Flex 4 Library project.
- Program your Library project. e.g. A very simple one would add a message in the constructor:

package {
        import mx.controls.Alert;
       
        public class AmethystLibrary1 {
               
                public function AmethystLibrary1( ) {
                        Alert.show( "Hello From Library" );                       
                }
               
        }
}

- Right-click AmethystLibrary1 and select Build.
- Add a reference to the library in your Application project (right-click the References node of the application project and select ‘Add reference’). ‘AmethystLibrary1’ will be listed in the Projects page. Click ‘Add’ and OK. The library will now be shown as a blue node under References.
- Now edit your test application to create a new AmethystLibrary1 object. If you are using Flex 3 you can use the Amethyst Designer for this (if you are using Flex 4 you should add an MXML/AS file to the project and set this to the main file by right clicking in the Solution Explorer - the current version of the designer only supports MXML, not Spark, applications). For example, you could switch to the Designer, drop a button onto the design area and double-click it to create an event-handler method. Then add this code:

private function button1_click (event:flash.events.MouseEvent):void {
        var test:AmethystLibrary1;
        test = new AmethystLibrary1( );
}

Note that AmethystLibrary1 will be shown in the IntelliSense completion list. When selected from this list the following ‘import’ will be added automatically:

import AmethystLibrary1;

Ensure that your application is set as the main project and run it. When you run the project you can now click the button on your application to execute the code in the library.

- Flex 4 not yet supported in the Designer

You may edit the design of Flex 4 Spark applications by editing the MXML code. You may design an MX project using all MX (Flex 3) components in an MX application file whether you are using the Flex 3 or Flex 4 SDK. The current build of the Amethyst Designer does not support Spark applications. This will be added in a later build.

Bookmark and Share   Keywords:  Amethyst  news
© SapphireSteel Software 2014