Twitter

The Twitter plugin allows a Follow, Share or Tweet button to appear in-game.

Twitter plugin compatibility

Since the Twitter API depends on opening separate browser windows, it usually only works inside a normal web browser. This means the button may not work when built in to a native app for Android or iOS, such as with Crosswalk, Ejecta or CocoonJS. To work around this, use the Browser object's Open URL in new window action to open a Twitter page instead.

Twitter properties

Type
One of the following button types:
Follow: a 'Follow' button to follow a Twitter account. The Share property should be the name of the Twitter account to follow, but without the @, e.g. Scirra to follow the account @Scirra.
Share: a 'Tweet' button to share a URL. The Share property must be a valid URL, e.g. http://www.scirra.com. The initial tweet text is set to the Text property, optionally displaying as Via a given account, with optional Hashtags.
Mention: a button to send a public tweet to another account. The Share property should be the name of the Twitter account to tweet to, without the @. The initial tweet text is set to the Text property, optionally displaying as Via a given account, with optional Hashtags.
Hashtag: a button to tweet with a hashtag. The Share property should be the hashtag to tweet with, without the # (e.g. Scirra to tweet with hashtag #Scirra). Additional hashtags can be added with the Hashtags property. The initial tweet text is set to the Text property, optionally displaying as Via a given account.

Share
The account to follow or mention, URL to share, or hashtag to tweet, depending on Type.

Text
The initial text to have in the tweet, which is selected so the user can easily replace it. This is not used when the Type is Follow.

Via
Optionally display the tweet as being via another twitter account, e.g. via @Scirra. The account should be set in this property without the @, e.g. Scirra to tweet via @Scirra. This is not used when the Type is Follow.

Hashtags
Comma-separated hashtags to add to the tweet, without the # (e.g. construct2,html5 to add the hashtags #construct2 #html5). This is not used when the Type is Follow. When the Type is Hashtag, the actual hashtag to share must be entered in the Share property instead, but this property can then be used to add extra hashtags to the tweet.

Initial visibility
Whether the button is initially visible or invisible.

Count
For Follow or Share buttons, which direction to show the count of how many users already follow or have already shared, or None to not show any count.

Size
Whether to use a medium or large style button.

Language
An ISO 639-1 language code to use for the button, which affects the text appearing on the button and in the popup window.

Twitter conditions

On button loaded
Triggered when the button has successfully loaded and is ready to be interacted with by the user. The button may not display until this triggers.

Twitter actions

Set hashtags
Set share
Set text
Set via
Set the corresponding object properties. For more information, see the properties documentation above. Any changes will not take effect until the button is reloaded.

Reload
Reload the button, so any changed properties then take effect.

Twitter expressions

The Twitter plugin does not have any of its own expressions.

Tags: