| Package | com.pluraprocessing.node.affiliate.web |
| Class | public class Plura |
| Inheritance | Plura flash.display.Sprite |
This class allows control of Plura. After instantiating an object, you can use it to start Plura, stop Plura, and change the percent of CPU that Plura is using. You cannot invoke changeCpuUsage(Number) while Plura is running (you must call stopPlura() first).
This class uses JavaScript to communicate with Plura via an iframe. As such, an iframe with id "pluraFrame" and the Plura JavaScript code must be available on the webpage that this method is called from. Also, allowScriptAccess must be set to "always" in the application that utilizes this class.
| Method | Defined by | ||
|---|---|---|---|
|
Plura(affiliateId:String, clientId:String, percentCpu:Number)
Instantiates a new Plura object.
| Plura | ||
|
changeCpuUsage(percentCpu:Number):void
Change CPU usage on the client computer and start running Plura if it is not already running.
| Plura | ||
|
getWorkUnitsCompletedByClient(clientId:String, date:Date):void
Get the number of work units completed by the specified client on the specifed day.
| Plura | ||
|
startPlura():void
Start running Plura on the client's computer.
| Plura | ||
|
stopPlura():void
Stop running Plura on the client's computer.
| Plura | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
Dispatched when the number of work units for a client id cannot be successfully retrieved
from getWorkUnitsCompletedByClient(String, Date)
| Plura | |||
Dispatched when the number of work units for a client id has been successfully retrieved
from getWorkUnitsCompletedByClient(String, Date)
| Plura | |||
| Plura | () | constructor |
public function Plura(affiliateId:String, clientId:String, percentCpu:Number)Instantiates a new Plura object.
ParametersaffiliateId:String — The affiliate id to be credited with the work units completed. This parameter is optional; null may be passed in. If not null, it must be a String representation of a valid UUID.
|
|
clientId:String — The id of the current client. This parameter is optional; if null or "" are passed in, a random id will be generated for the client. Must be less than 40 characters in length.
|
|
percentCpu:Number — The percentage of the client computer's CPU to use for Plura. Must be less than 1 and greater than 0.
|
PluraParameterError — If the values passed into this method are invalid.
|
| changeCpuUsage | () | method |
public function changeCpuUsage(percentCpu:Number):voidChange CPU usage on the client computer and start running Plura if it is not already running.
ParameterspercentCpu:Number — The percentage of the client computer's CPU to use for Plura. Must be less than 1 and greater than 0.
|
PluraStateError — If this method is invoked while Plura is running (call stopPlura() first).
|
|
PluraParameterError — If the values passed into this method are invalid.
|
| getWorkUnitsCompletedByClient | () | method |
public function getWorkUnitsCompletedByClient(clientId:String, date:Date):voidGet the number of work units completed by the specified client on the specifed day. A client's work units for a given day will be available 48 hours after the day is over.
If the work units are successfully retrieved for the given client, the PluraEvent.PLURA_SUCCESS event will be dispatched. Otherwise, the PluraEvent.PLURA_ERROR event will be dispatched.
ParametersclientId:String — The id of the client for which to retrieve the number of work units.
|
|
date:Date — The day for which to retrieve the number of work units. The time part of this parameter is not used.
|
PluraStateError — If this method is invoked while Plura is running (call stopPlura() first).
|
|
PluraParameterError — If the values passed into this method are invalid.
|
| startPlura | () | method |
public function startPlura():voidStart running Plura on the client's computer.
JavascriptMissingError — If the Javascript required to communicate with Plura does not exist on the HTML page.
|
|
PluraCommunicationError — If there is an error setting the Plura iframe URL.
|
| stopPlura | () | method |
public function stopPlura():voidStop running Plura on the client's computer.
JavascriptMissingError — If the Javascript required to communicate with Plura does not exist on the HTML page.
|
|
PluraCommunicationError — If there is an error setting the Plura iframe URL.
|
| pluraError | event |
com.pluraprocessing.node.affiliate.web.PluraEvent
com.pluraprocessing.node.affiliate.web.PluraEvent.PLURA_ERROR
Dispatched when the number of work units for a client id has been successfully retrieved
from getWorkUnitsCompletedByClient(String, Date)
The PluraEvent.PLURA_ERROR constant defines the value of the
type property of the event object
for a pluraError event.
| pluraSuccess | event |
com.pluraprocessing.node.affiliate.web.PluraEvent
com.pluraprocessing.node.affiliate.web.PluraEvent.PLURA_SUCCESS
Dispatched when the number of work units for a client id has been successfully retrieved
from getWorkUnitsCompletedByClient(String, Date)
The PluraEvent.PLURA_SUCCESS constant defines the value of the
type property of the event object
for a pluraSuccess event.
The properties of the event object have the following values:
| Property | Value |
|---|---|
| result | The number of work units completed by the client specified in the call to getWorkUnitsCompletedByClient. |