Skip to main content
DJ Gecko
Inspiring
July 23, 2015
Answered

Twitter - loading tweets, favorite tweets and retweeting

  • July 23, 2015
  • 1 reply
  • 580 views

Does anyone know if there are any libraries that are still maintained or at least valid for working with the Twitter API?

Thanks.

This topic has been closed for replies.
Correct answer kglad

the following is an excerpt from a book (Flash Game Development: In a Social, Mobile and 3D World) i published 2 years ago,

Requests That Require Authentication

Two main steps are needed to use requests that requires authentication. First, you must register your game with Twitter. Second, you must either implement the OAuth protocol or use a library like Tweetr that implements the protocol.

Game Registration

To use requests that require authentication (and those for which it is supported), you must first register your game with Twitter at https://dev.twitter.com/apps/new.  (See Fig11-12.)

***Insert Fig11-12.tif***

              [The Twitter application registration page at https://dev.twitter.com/apps/new.]

Fill out their form, agree with all those rules, prove you are a human being by filling out the Captcha form and click the Create your Twitter application button. You should see Fig11-13.

***Insert Fig11-13.tif***

              [After successful registration, copy your Consumer key and secret.]

Copy your Consumer key and Consumer secret. You will need both to make authenticated requests on behalf of users. These numbers are used by Twitter to identify your game when a user gives your game permission to make requests on their behalf.

Click the Settings tab (see Fig11-14) and add an icon or change your settings, if needed. In particular, note the Application Type settings.  If you need more than read-access, tick the Read and Write or Read, Write and Access direct messages.

***Insert Fig11-14.tif***

              [The Twitter application registration page at https://dev.twitter.com/apps/new.]

Click the Update this Twitter application's settings if you made any changes or additions.

Tweetr

Tweetr is a free open-source ActionScript library that implements the OAuth protocol and allows your game to make Twitter requests that require authentication. Setting up your game to use Tweetr is a multi-step process.

All the needed files are in support files/Chapter 11/twitter/authentication. But to ensure you have the latest files go to http://wiki.swfjunkie.com/tweetr.

  1. Download and extract swcs.zip
  2. Download and extract oauth_template.zip
  3. Download and extract docs.zip
  4. Download and extract proxy.zip
  5. Add tweetrWEB swc to your library path extracted from the swc.zip.
  6. Go to http://code.google.com/p/as3crypto/downloads/list and download as3crypto.swc
  7. Add as3crypto.swc to your library path.  (See Fig11-15.)
  8. Find the js folder extracted in step 2 and upload it to your server.
  9. Find the proxy folder (that contains index.php, install.php and Tweetr.php) extracted in step 4 and upload to your website.
  10. Open your website's install.php file in your browser and follow the steps to create the needed files.  Here is a walk-through: http://wiki.swfjunkie.com/tweetr:howtos:installing-the-proxy
  11. Create a verified.html page and upload it to your server:
  12. Create twitter.html, your swf's embedding html page, and upload it to your server:
  13. Upload the swfObject folder from support files/Chapter 11/twitter/authentication

***Insert Fig11-15.tif***

              [You should have both TweetrWEB.swc and as3crypto.swc in your library path and both should have Link Type: Merged into code. Your paths will be different from that shown.]

  • verified.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <script language="JavaScript" type="text/JavaScript" src="js/tweetrOAuth.js"></script>

</head>

<body>

    <script type="text/JavaScript">

OAuth.verify();

    </script>

</body>

</html>

  1. twitter.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>

    <script language="JavaScript" type="text/JavaScript" src="js/tweetrOAuth.js"></script>

    <script language="JavaScript" type="text/JavaScript" src="js/swfobject.js"></script>

</head>

<body>

    <div id="flashDiv">

        no flash

    </div>

    <script type="text/JavaScript">

        var so = new SWFObject("twitter.swf", "twitter", "700", "400", "9", "#336699");

so.addParam("allowScriptAccess", "always");

so.write("flashDiv");

    </script>

    <script type="text/JavaScript">

OAuth.setFlashElement("twitter");

    </script>

</body>

</html>

Your now ready to create your game, twitter.swf.  In the document class code below, I show how to use the Tweetr class to obtain authentication and make requests that require authentication.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
July 24, 2015

the following is an excerpt from a book (Flash Game Development: In a Social, Mobile and 3D World) i published 2 years ago,

Requests That Require Authentication

Two main steps are needed to use requests that requires authentication. First, you must register your game with Twitter. Second, you must either implement the OAuth protocol or use a library like Tweetr that implements the protocol.

Game Registration

To use requests that require authentication (and those for which it is supported), you must first register your game with Twitter at https://dev.twitter.com/apps/new.  (See Fig11-12.)

***Insert Fig11-12.tif***

              [The Twitter application registration page at https://dev.twitter.com/apps/new.]

Fill out their form, agree with all those rules, prove you are a human being by filling out the Captcha form and click the Create your Twitter application button. You should see Fig11-13.

***Insert Fig11-13.tif***

              [After successful registration, copy your Consumer key and secret.]

Copy your Consumer key and Consumer secret. You will need both to make authenticated requests on behalf of users. These numbers are used by Twitter to identify your game when a user gives your game permission to make requests on their behalf.

Click the Settings tab (see Fig11-14) and add an icon or change your settings, if needed. In particular, note the Application Type settings.  If you need more than read-access, tick the Read and Write or Read, Write and Access direct messages.

***Insert Fig11-14.tif***

              [The Twitter application registration page at https://dev.twitter.com/apps/new.]

Click the Update this Twitter application's settings if you made any changes or additions.

Tweetr

Tweetr is a free open-source ActionScript library that implements the OAuth protocol and allows your game to make Twitter requests that require authentication. Setting up your game to use Tweetr is a multi-step process.

All the needed files are in support files/Chapter 11/twitter/authentication. But to ensure you have the latest files go to http://wiki.swfjunkie.com/tweetr.

  1. Download and extract swcs.zip
  2. Download and extract oauth_template.zip
  3. Download and extract docs.zip
  4. Download and extract proxy.zip
  5. Add tweetrWEB swc to your library path extracted from the swc.zip.
  6. Go to http://code.google.com/p/as3crypto/downloads/list and download as3crypto.swc
  7. Add as3crypto.swc to your library path.  (See Fig11-15.)
  8. Find the js folder extracted in step 2 and upload it to your server.
  9. Find the proxy folder (that contains index.php, install.php and Tweetr.php) extracted in step 4 and upload to your website.
  10. Open your website's install.php file in your browser and follow the steps to create the needed files.  Here is a walk-through: http://wiki.swfjunkie.com/tweetr:howtos:installing-the-proxy
  11. Create a verified.html page and upload it to your server:
  12. Create twitter.html, your swf's embedding html page, and upload it to your server:
  13. Upload the swfObject folder from support files/Chapter 11/twitter/authentication

***Insert Fig11-15.tif***

              [You should have both TweetrWEB.swc and as3crypto.swc in your library path and both should have Link Type: Merged into code. Your paths will be different from that shown.]

  • verified.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <script language="JavaScript" type="text/JavaScript" src="js/tweetrOAuth.js"></script>

</head>

<body>

    <script type="text/JavaScript">

OAuth.verify();

    </script>

</body>

</html>

  1. twitter.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>

    <script language="JavaScript" type="text/JavaScript" src="js/tweetrOAuth.js"></script>

    <script language="JavaScript" type="text/JavaScript" src="js/swfobject.js"></script>

</head>

<body>

    <div id="flashDiv">

        no flash

    </div>

    <script type="text/JavaScript">

        var so = new SWFObject("twitter.swf", "twitter", "700", "400", "9", "#336699");

so.addParam("allowScriptAccess", "always");

so.write("flashDiv");

    </script>

    <script type="text/JavaScript">

OAuth.setFlashElement("twitter");

    </script>

</body>

</html>

Your now ready to create your game, twitter.swf.  In the document class code below, I show how to use the Tweetr class to obtain authentication and make requests that require authentication.

DJ Gecko
DJ GeckoAuthor
Inspiring
July 24, 2015

Thanks!!!!

kglad
Community Expert
Community Expert
July 24, 2015

you're welcome.