|
ProjectSetup
Project SetupTo get started with Swiz, first make sure you have downloaded the latest version of the swiz.swc library from http://code.google.com/p/swizframework/downloads/list. Alternately you can check out the Swiz source code through svn and compile it yourself. Once you have obtained Swiz, you need to create a new project in Flex Builder and add the swiz.swc library to your project. Create a new project in Flex Builder and choose either a Web or Desktop application. You can leave the Application Server Type set to 'none'. Swiz comes with a convenient utility class, DynamicChannelSet which enables you to compile your application without pointing it at flex-services.xml. If you are using Flex Builder 3, you should already have a libs directory in your project root. Just place the swiz.swc there and refresh or clean your project. If the libs directory does not exist create it, then right click on your project, select Properties > Flex Build Path > Library Path, select 'add SWC folder' and select the libs directory you just created. Alternately, you can open .actionScriptProperties and add a new element under <librarypath defaultLinkType="1"> such as the following: <libraryPathEntry kind="1" linkType="1" path="libs"/> Place swiz.swc in the libs directory and your ready to go! Swiz uses custom metadata, which is compiled into swiz.swc. As long as you are using the Flex 3 SDK, there is nothing else that needs to be done. However if you are using an earlier SDK, you will need to enable the metadata. For Flex 2 and earlier users only! Right click on your project in Flex Builder, and select Properties > Flex Compiler. Under 'Additional compiler arguments' add '-keep-as3-metadata+=Autowire' to the existing values. If you created a basic project your compiler arguments should read: -locale en_US -keep-as3-metadata+=Autowire,Mediate Alternately, you can open the .actionScriptProperties file located in your project's root directory and add '-keep-as3-metadata+=Autowire' to the 'additionalCompilerArguments' element on line 2. Now Swiz's metadata is enabled and will be properly compiled into your application. You're now ready to start working with Swiz! The next sections describe defining your application components to Swiz, creating Controller objects, working with asynchronous service calls, dynamically creating chained command objects, and handling events through Swiz. I would suggest reading through all the following sections to get a good overview of Swiz, but if you have a short attention span, you can download the swiz-test-examples.zip from http://code.google.com/p/swizframework/downloads/list and pick through the flex code. Hopefully, you'll find Swiz surprisingly simple and easy to work with. |
Sign in to add a comment
You have to add the -keep-as3-metadata+=Autowire,Mediate to Flex 3 as well. Even flex throws away most of it's metadata tags when compiling to swf, except for Bindable? and a few others. I'm building with flex sdk 3.2 and it fails to work if I don't set the compiler arguments, as you described for Flex 2
To clarify, the -keep-as3-metadata settings only apply to building Swiz itself in Flex 3. As of Flex 3, if your project references a SWC that includes custom metadata, like Swiz's SWC does, you don't need to do anything extra. In Flex 2, the metadata names included in a referenced SWC were ignored and not included in the output SWF so you had to repeat them in the compiler args of any project that used a SWC that needed metadata.
For Flex 3 SDK
adding 'Additional compiler arguments' -keep-as3-metadata+=Autowire,Mediate is not required.
Only thing required is to add swiz-x.x.x.swc in the lib directory
Thats Cool !!
Steps for developing an Flex application using Swiz Framework:
Step 1: Define Application Components
Step 2: Create Controller objects,
Step 3: Process Asynchronous Service Calls
Step 4: Dynamically creating chained command objects
Step 5: Handling events