Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 2.05 KB

README.md

File metadata and controls

55 lines (44 loc) · 2.05 KB

Patreon-Authenticator-as3-air

Connect Flash to Patreon and reward your patreons. (FLA file works on Animate CC only)

How to get started


1- Download Patreon.fla file
2- Copy the login button to your Animate CC(Library)
3- connect using Patreon.login( your_patreon_client_id_here );

If you don't know where to get your client_id, go here: https://www.patreon.com/portal

How to use properly

If you just use the Patreon.login(client_id) function, it would be enough.
Now, let's say you want to get the information once connected. Here is a sample code:

//Step 1: Use onStatus to know when you are connected

Patreon.onStatus = function (stat){
if (stat==-1) trace("ERROR");
if (stat== 1) connected();
}

//Step 2: Connect

Patreon.login(client_id_here);

//Step 3: Get the information once connected

function connected(){
trace("User E-Mail" + Patreon.email);
trace("Is rewarded with cool thing" + Patreon.hasReward("cool thing"));
}

Functions

Patreon.login(client_id)

Connects to patreon and gets the current user

Patreon.logout()

Altough it is meant for logging out, it is also used to cancel the login, especially if user didn't press on allow.

Patreon.hasReward(reward_title)

Returns true if the user is eligable for the reward specified.

Functions and Variables

Patreon.email:String

this contains the patreon e-mail once connected. Otherwise, it is null.

Patreon.rewards:Vector. < PatReward >

Contains and array (Vector) information about the rewards.
Patreon.rewards[0].id //reward 0 id
Patreon.rewards[0].amount_cents //How much payed in cents
Patreon.rewards[0].description //reward 0 description
Patreon.rewards[0].title //reward 0 title

In general, here is the verification code:
public var id:String;
public var amount_cents:Number;
public var description:String,title:String;
public var user_limit:int,patron_count:int,post_count:int,remaining:int;