Navigation Menu

Skip to content

socialvibe/engagement_api

Repository files navigation

Requirements
-----------
Flash Builder 4 or better, or Flash Professional CS4 or better.
Must use AS3.

Files Provided
--------------
- engagement_api.swc
This file will setup code hinting and load the SocialVibe Engagement API.

- EngagementExample.as
This is an example engagement using the SocialVibe Engagement API.

- AS3_FLA/
This folder contains an example of using Flash CS5 to create an engagement using the Engagement API.

- AS3_FLA_Timeline/
This folder contains an example of creating an timeline based engagement using Flash CS5 with the Engagement API.

Documentation
-------------
http://stash.socialvi.be/asdocs/com/socialvibe/engagement/EngagementAPI.html

Environment Setup (in flash builder)
-----------------
1) Download engagement_api.swc from this GitHub project and place it somewhere you can find it later (typically in a 'lib' folder in your Flash project).
2) In Flash Builder, open your existing AS3 project or create a new one.
3) Go to Project->Properties->Actionscript Build Path
4) Under the 'Library Path' tab, click on 'Add SWC...'
5) Find the engagement_api.swc and add it.
6) You should now be able to instantiate and use com.socialvibe.engagement.api.SocialVibeProxy in your Flash project.

Using a FLA
-----------
1) Make sure you have downloaded engagement_api.swc as above.
2) In your .fla environment, goto File->Publish settings...->'Flash' (on top)->'Settings...'
3) Pick 'Library path' on the bottom bar.
4) Then click on the 'F' button for SWC file addition.
5) Then navigate to engagement_api.swc, and click on ok.

API Usage
-----------
The 'engagement_api.swc' in the lib folder, is a file which you will add to your library, and give you access to a class called 'SocialVibeProxy()'.  This proxy class gives you access to SocialVibe's engagement API.  When your engagement is running outside of SocialVibe's engagement environment, the proxy will run in 'unconnected mode'.  In this mode calls to the API will simply output trace statements and return placeholder values when necessary since it doesn't have an instance of the API to proxy calls to.

Once you instantiate the SocialVibeProxy() class, you will have several calls at your disposal for purpose of saving data, tracking interactions, and various API functionality.  You should instantiate the SocialVibeProxy class as soon as possible (preferably in your constructor) to ensure we record the full amount of time spent on your engagement.


Required API Calls
------------------
- SocialVibeProxy::engage()
Make this call to signal the completion event for the engagement.  The completion event tells our system to grant the user the appropriate user benefit (i.e. Farm Cash on FarmVille) 

- SocialVibeProxy::endEngage()
Make this call after the engage() call at the point the engagement has ended and to show the user a 'congrats & share screen'.


Testing
-------
Test your engagement SWF within our engagement container using this test page:
http://socialvibe.github.com/engagement_api/test.html

1) Setup - Enter any setup data you need (all this data is optional)
2) Load - Upload the SWF you've built using the engagement API
3) Run - Your SWF will be loaded into our engagement container as it would in our live system.  As you run through the engagement, some debugging info will be output at the bottom.


Notes
--------------
- If you use external SWFs or Files make sure your crossdomain.xml is setup to handle *.socialvibe.com, *.socialvi.be, and *.svnetwork.com.
- If you are using Greensock's Tweening Platform, please use v11 release (http://www.greensock.com/v11/).