====== Getting Started ======
In this document we describes how to get started using the WebClient API for Flex. \\
This tutorial describes how to get started using Adobe Flash Builder specifically.
===== 1. Project Setup =====
Create a new project by selecting ''File -> New -> Flex Project''. This prepares a new Flex project with an empty mxml application ready to go.
==== Add compiler flag ====
Because the library embeds a SWF component that integrates with flex, you must add a compiler flag to your project.
To set compiler flags, open your project properties (right-click -> properties) and select the ''Compiler'' section on the left hand side. Add this flag to the list :
-includes+=mx.managers.systemClasses.MarshallingSupport
{{compiler_flag.png|}}
==== Enable direct rendering ====
the WebClient uses the Stage3D API made available by Flash Player. To use this API, the Flash Player must be started in "direct" rendering mode. This can be done by setting the "wmode" attribute.
In Flash Builder you can achieve this by editing the ''index.template.html'' file in the ''html-template'' folder.
{{edit_template.png|}}
Then add this line :
{{edit_template_wmode.png|}}
==== Add the library ====
First you should add the Flex library to your project. By default Flash Builder will prepare a "libs" folder that contains all libraries that are automatically added to the project. You can simply drag & drop the ''webclient_api_flex.swc'' file to this folder.
{{add_library.png|}}
==== Use the SWF file ====
The API itself is implemented in a file called ''webclient_api.swf''. The Flex library is a wrapper around this SWF file giving easy access to the available functions and events. As a result, the Flex library needs a reference to this SWF file before it can be used.
There are 2 ways to do this.
=== Reference the swf file on your Publisher server ===
You can configure the location of the swf file that is used, by setting the ''swfFile'' property of the ''orbit.webclient.Client'' component. You can configure this property to reference your own Orbit Publisher server for example :
Referencing the swf file on the Publisher server is highly recommended.\\ This makes it possible to update the SWF component when upgrading the server.
=== Copy the swf file to your application folder ===
You can make sure the swf file exists in the same folder as your application. When developing, you can achieve this by copying the swf file to the application 'source' folder like this :
{{add_swf.png|}}
You can find this file in the 'api' folder of your Orbit Publisher server.
Make sure you copy the ''webclient_api.swf'' file next to your final application as well.
===== 2. Using the component =====
Below is a simple application that handles license activation and then loads a publication.