Examples (iOS)
Examples (Android)

 

» Flash platform examples

In this section of the documentation we provide a series of brief tutorials on the ActionScript 3 examples for the Flash platform distributed as a specific package on the SmartFoxServer 2X download page.

Most tutorials analyse a single example, describing its objectives, giving an insight into the SmartFoxServer features it wants to highlight and providing the direct link to download the source code, which includes all the assets required to compile and test it (both client and — if existing — server side). If necessary, code excerpts are provided in the tutorial itself, in order to better explain the approach that was followed to implement a specific feature. At the bottom of the tutorial, additional resources are linked if available.

The tutorials are ordered following the increasing complexity of the examples they refer to: we go from the simplest application we could think of, which just shows how to connect to SmartFoxServer, to a fully featured realtime game which uses UDP communication and more.

Additional examples can be found in the SmartFoxBits and OpenSpace packages. There are no dedicated tutorials describing these examples, but the source code is fully commented to help developers understand what is going on.

» Flash vs Flex

Some of the examples have been developed using Adobe Flash, while others using Adobe Flash Builder (aka Flex). We are not going to provide the same example using both technologies; the rationale behind this decision is very simple: the SmartFoxServer API for both environments is exactly the same, and the difference between the two is just a matter of User Interface development. As the UI implementation is out of the scope of these tutorials, we strongly encourage you to study the ActionScript code of the examples even if they don't match your platform of choice. You will still be able to understand how to interact with the SmartFoxServer API, and to transfer the knowledge to your environment.

Unless otherwise noted inside the tutorials:

NOTE 1
All the examples make use of the latest version of the SmartFoxServer 2X ActionScript 3 API available when they have been published. As the API evolve in time (bug fixes, new features), we strongly recommend that, after downloading an example, you overwrite the included API SWC file (SFS2X_API_AS3.swc in the source code's libs folder) with the one provided in the latest SmartFoxServer package or patch available on our website.

NOTE 2
Testing the examples by double clicking the HTML file or the SWF file directly might result in a connection error. For security reasons, Flash Player blocks SWF content stored locally from accessing the network resources, and vice-versa. You can resolve this issue by using the Trusted Location Settings panel in the Flash Player settings. Please read the Developer tools section of this document.

» SmartFoxBits

Some of the provided example make use of one or more user interface components belonging to the SmartFoxBits set. This approach has three main advantages:

  1. we are not forced to write the same, repetitive code over and over: in fact all multiuser applications/games –including our examples– perform the connection to the server and make users enter their credentials to login; also, most of them allow users to chat in a dedicated panel, display a list of available Rooms and show a list of the users in the current Room;
  2. the development speed is much improved because it is focused on the objectives of the example;
  3. the code is much more lightweight and limited to the the specific logic of the example, makind it easier to walkthrough and understand.

In order to learn how to implement the features covered by the SmartFoxBits components, you can refer to initial examples, in particular the Simple Chat and the Advanced Chat.

Time to click on the first example in the sidebar... enjoy the reading!