Posted by Sandro on March 15th, 2009

Updated: Tweetr AS3 Library

tweetr

UPDATED: Tweetr has gotten an Update since this blog post. See this blog post for more infos.

As promised, i just updated my Tweetr AS3 Library. For those who do not know what Tweetr is – Tweetr is a simple to use AS3 Twitter API Library, including practically all twitter and twitter search API features  and an URLShortener Class.

The new version sports the following improvements:

  • couple fixes to authentication for a couple GET Requests
  • a brand new PHP Proxy Class that allows Tweetr to be used even for content that is supposed to be deployed on websites! (see why.)
  • finally some examples on how to use it :)

As always, let me know what you are going to create with it, or if you need any help and of course any type of critique is always welcome!

Related Posts
Post a Comment


69 Comments »

  1. Hi

    I’d love to use Tweetr in my Flash AS3 project. I am programming using the Flash CS3 IDE. I think I can decipher your Flex code well enough to make it work (my AS3 isn’t advanced). My problem is I cannot find the import classes in the downloads from your Google Code page for example I get compile errors when I try this, where are these classes?

    import com.swfjunkie.tweetr.Tweetr;
    import com.swfjunkie.tweetr.events.TweetEvent;
    import com.swfjunkie.tweetr.data.objects.StatusData;

    I would greatly appreciate your help, do you have a Flash IDE example?

    Thanks

    Dave

    comment-bottom
  2. Sandro says:

    Heya Dave

    You are correct, there is no download at the moment for the sources. You can however use the supplied SWC. I will post an example for pure actionscript projects later today and also the sources as a download. Hope that will help you out. If you end up using it, let me know what you built with it ;)

    Have a nice day,
    Sandro

    comment-bottom
  3. Thanks Sandro! I did download the SWC, but I didn’t know what to do with it! I might be able to figure it out if you can explain what I should be doing with it, however it might just be easier to wait for your pure AS project. Really appreciate your help, finding an easy to use Twitter AS3 API is impossible, but hopefully yours will do the job nicely as it seems to! Thanks again.

    comment-bottom
  4. Sandro says:

    I just updated the tweetr project and added a pure as3 example.. I also added the source files to the downloads.

    As for adding SWC Files to your project. It depends on what IDE you are using since adding SWC’s to a project is different for pretty much all IDE’s.

    comment-bottom
  5. Thanks for this Sandro. To be honest I am a little lost. Firstly on how to use the SWC within the Flash CS3 IDE, I have tried adding it to the application support > adobe > Flash CS3 > en > configuration > components folder in the file system but I don’t know what to do after that. Can you help?

    comment-bottom
  6. Sandro says:

    well.. after that you would have to just do the imports. Since i’m using CS4 and dont’ have CS3 installed anymore i sadly can’t really tell you the steps on how to do it. But since the source files are available now you might want to use those. just unpack the com folder into the folder where your fla is going to be. and then do the imports as usual. That’s should work just fine.

    -Sandro

    comment-bottom
  7. HI Sandro. Thanks again for answering my questions. As I said my AS3 is rusty so if I explain exactly what I am doing maybe you can let me know where I am going wrong.

    I have the Example and and tweeter.swc files in the same folder as my FLA. Within my FLA I set ‘Example’ as the document class and then publish preview. I then get the compile errors saying that StatusData and TweetEvent cannot be found.

    When you mentioned source files in your previous post, what are you referring to, the SWC or the AS or something else? I cannot see a ‘com’ folder in any of your downloads. If I had that I think I’d know what to do, but as I haven’t I think I am getting confused. As always a really appreciate your help.

    Thanks

    Dave

    comment-bottom
  8. Hi Sandro, ignore my previous post! I found your src files!

    Now I have an FLA, the com folder and Example.as all in the same directory. My FLA has a document class of ‘Example’. When I run it I get one error of ‘Definition mx.events:IndexChangedEvents could not be found. Any ideas?

    comment-bottom
  9. HI Sandro! I have managed to get this working. I am only using ‘getUserTimeline’ at the moment but will upload the website when live and notify you so you can see what I have done.

    Here is the AS I have written, please can you tell me how to limit the number of statuses I display in the ‘getUserTimeline’ function as it doesn’t seem to be working at the moment:

    [code]

    import com.swfjunkie.tweetr.Tweetr;
    import com.swfjunkie.tweetr.data.objects.StatusData;
    import com.swfjunkie.tweetr.events.TweetEvent;
    import com.swfjunkie.tweetr.utils.TweetUtil;

    initTweetr();

    // Tweetr
    function initTweetr():void
    {
    tweetr = new Tweetr();
    tweetr.serviceHost = “labs.swfjunkie.com/tweetr/proxy”;

    tweetr.addEventListener(TweetEvent.COMPLETE, handleTweetsLoaded);
    tweetr.addEventListener(TweetEvent.FAILED, handleTweetsFail);

    tweetr.getUserTimeLine(“username”, “password”, null, 200, 0);
    }

    // Variables
    var tweetr:Tweetr;

    // Eventhandling
    function handleTweetsLoaded(event:TweetEvent):void
    {
    var displayText:String = “”;

    for(var i:int = 0; i < event.responseArray.length; i++)
    {
    var statusData:StatusData = event.responseArray[i];
    displayText = displayText + statusData.user.screenName + “\n”;
    displayText = displayText + statusData.text + “\n\n”;
    }

    output.text = displayText;
    }

    function handleTweetsFail(event:TweetEvent):void
    {
    output.text = “Tweets failed!”;
    }

    [/code]

    comment-bottom
  10. Sandro says:

    heya dave, i took your code and corrected it and added some inline comments. Hope that works for you:

    import com.swfjunkie.tweetr.Tweetr;
    import com.swfjunkie.tweetr.data.objects.StatusData;
    import com.swfjunkie.tweetr.events.TweetEvent;
     
    initTweetr();
     
    // Tweetr
    function initTweetr():void
    {
        tweetr = new Tweetr();
        // using labs.swfjunkie.com as proxy host is a bad idea
        // since i can't guarantee that the proxy will always be there
        // download the php proxy and install it on your server to be safe.
        tweetr.serviceHost = "labs.swfjunkie.com/tweetr/proxy";
     
        tweetr.addEventListener(TweetEvent.COMPLETE, handleTweetsLoaded);
        tweetr.addEventListener(TweetEvent.FAILED, handleTweetsFail);
     
        //to set username and password do
        // if you are using your own php proxy instance
        // you will be able to mask the username and password
        tweetr.username = "username";
        tweetr.password = "password";
     
        tweetr.getUserTimeLine();
    }
     
    // Variables
    var tweetr:Tweetr;
     
    // Eventhandling
    function handleTweetsLoaded(event:TweetEvent):void
    {
        var displayText:String = "";
     
        for(var i:int = 0; i < event.responseArray.length; i++)
        {
            var statusData:StatusData = event.responseArray[i];
            displayText += statusData.user.screenName + "\n";
            displayText += statusData.text + “\n\n”;
        }
     
        output.text = displayText;
    }
     
    function handleTweetsFail(event:TweetEvent):void
    {
        output.text = “Tweets failed!;
    }

    -Sandro

    comment-bottom
  11. vijay says:

    I’m getting this error -” 1172: Definition mx.events:IndexChangedEvent could not be found. ” when I run the modified code posted by Sandro. I’m using Flash CS4, com folder placed in the same folder as .fla, actionscript setting – AS3. Please help me fix this issue.

    comment-bottom
  12. Sandro says:

    This is infact a bug in the Tweetr Library. I just saw that there is an import line in the Main Class File that is not supposed to be there. Stupid mistake :P

    Until i release an update you can manually fix this if you have the sources by deleting line 18 in Tweetr.as (/com/swfjunkie/tweetr/Tweetr.as) that reads:

    import mx.events.IndexChangedEvent;

    Hope that helps for now :)

    comment-bottom
  13. TomS says:

    Sounds like great work Sandro. I’m new to this page.. Tell me do you have any examples posted on what you Tweetr can do? Does it offer access to all of Twitter’s functionality inside of a swf for example?

    I’d like to do something simple to start – maybe just post the latest tweet from a specific user.

    have to run – i’ll check back later. looking forward to where you’ll go with this!

    -Tom

    comment-bottom
  14. Abraham Lloyd says:

    Hi Sandro,

    First off; kudos to you. I like your library alot. Well documented, easy to work with. How cool is that?

    I’m writing an AIR Twitter application, and running into an issue when I attempt to authenticate a user. In Tweetr, I go ahead and set the un / pw for the user, then to test their account information I kick of getReceivedDirectMessages. I’m expecting a fault event of some type if the user can’t be authenticated against the Twitter API. Instead, I get a network prompt from Twitter asking me for a username / password.

    I was curious; have you seen this before? If so, do you have any suggestions / ideas on how to bypass this dialog prompt? Thank you in advance, and if you need any additional information, please let me know.

    Best,

    A.

    comment-bottom
  15. jay says:

    awesome work but my one problem right now is using the last status method.

    when i make a StatusData object and call

    statusData.user.lastStatus; it always

    returns a null value. any suggestions?

    comment-bottom
  16. Blake J says:

    Hi, I’m glad I found your blog.
    I’m having the same issue trying to link into my RSS feed from my Twitter account and having it asking for my username and password.
    What I’ve done is use the HTTPService tag and copied the url of my Twitter account RSS feed into its url. I was wondering if you know have to declare a param or something so that it knows my un and pw.
    Thanks for your time.

    comment-bottom
  17. adrian says:

    I believe I am having more or less same problem as Blake J and a couple other people. The API overall works outstanding, but I have a problem as soon as I try to use a method such as getFriendsTimeLine() that needs authentication….that fails always (TweetEvent.FAILED). Can’t get it to work for the life of me, in Flash CS4 IDE, out of IDE, with and without proxy. I’m stumped. Any ideas?

    getPublicTimeLine() and other methods work great.

    (I’m using the open-sourced classes themselves since for some reason could not install the SWC.)

    comment-bottom
  18. adrian says:

    Update to last comment:
    TweetEvent.STATUS == 401
    Authentication problem of some kind.

    comment-bottom
  19. jay says:

    i figured out my status problem but i have another one. can you not have two tweetr objects if one uses authentication to get data? because I have made two objects and one gets a search and the other a public time line, but when i try to have an object get a public timeline and the other one gets my friendlist the object getting the public timeline always fails.

    comment-bottom
  20. jay says:

    another thing you can’t use the showsingletweet method unless your authenticated which to use it, it doesn’t require.

    comment-bottom
  21. adrian says:

    Did more testing: methods requiring authentication (eg, getFriendsTimeLine) work fine from AIR, though they fail (for me, anyway) in straight-up Flash.

    I believe this has to do with security update Adobe made with 9.0.115
    http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403184
    Kind of a big headache not only for this but for anything requiring an Authorization header.

    Sandro, any future plans for authenticating via oauth?

    comment-bottom
  22. Simone says:

    Hi Sandro,
    i tried your class with Flash CS4 IDE.
    If i use your serviceHost it’s all right.
    If i try with my serviceHost i read this error:

    Error opening URL ‘http://burnedbrain.com/proxy/statuses/public_timeline.xml’

    tks

    comment-bottom
  23. Sandro says:

    I’m sorry it’s been so quite from my side up till now. I’ve been rather busy with a work related project.

    For those of you who still have problems using the Library, could you please make a post over at the Tweetr Library GoogleGroup ? It will make it easier for me to help you guys out.

    Here is the Link to the GoogleGroup:
    http://groups.google.com/group/tweetr-as3-library

    Thanks for using Tweetr and hope to talk to y’all soon

    comment-bottom
  24. silentium says:

    Hallo & THX first !

    Just needed your Lib for a demo and had some problems with the Tweetr.php proxy and curl_setopt_array() function. Really no Idea why cause curl is enabled.. problem may be this helps:

       private function curl_setopt_array2(&$ch, $curl_options)
       {
           foreach ($curl_options as $option => $value) {
               if (!curl_setopt($ch, $option, $value)) {
                   return false;
               } 
           }
           return true;
       }
    	/**
    	 * Requests Basic Authentication
    	 */
    	private function requestCredentials()
    

    than change

    curl_setopt_array($curl, $opt);
    

    to

    $this->curl_setopt_array2($curl, $opt);
    
    comment-bottom
  25. Hi Sandro,

    Hey this is a little awkward, but I have been making a Twitter client called “Tweetr” for the last 2 years since the beta of Adobe Air.

    It is very confusing that your have called your AS3 public class library Tweetr and confuses my product as well, which is actually written in AS3 and Flex.

    I do request that you do not use this name in the future and if you would be kind enough to change the name. I absolutely have no issue with an open source AS3 library but people will be thinking of open sourced Tweetr and its source code which is not the case.

    Many regards, John Ballinger developer of Tweetr.

    comment-bottom
  26. hartum says:

    Warning!!!

    If you are using AIR, don’t forget turn public var browserAuth to false in line 146 from Tweetr.as, just like this:

    public var browserAuth:Boolean = false;

    I spent 2 weeks to get it work with my AIR aplaication.

    p.d: sorry for my english

    comment-bottom
  27. CAN YOU PLEASE STOP USING MY SOFTWARE’S NAME FOR THIS PROJECT. I AM NOT GETTING PEOPLE EMAILING ME THINKING THIS IS AN OPEN SOURCE VERSION OF TWEETR.

    AGAIN SEE COMMENT ABOVE. PLEASE RENAME THIS PROJECT.

    MANY REGARDS, JOHN.

    comment-bottom
  28. Tcoz says:

    Hey Sandro great work. Two questions:

    – Any plans to integrate an OAuth library (can’t really build a commercial-quality client with Basic Auth).
    – I added the [Bindable] attribute above the class declaration of your UserData class to make the “warning can not bind to property [etc.] on com…UserData” warnings go away.

    comment-bottom
  29. Kemas says:

    Hi, sandro

    i would like to use this, but have no idea how to start..

    any tutorial?

    comment-bottom
  30. Hi there, Tweetr suffers from the twitpocalypse bug. This can be easily fixed by changing the ‘id’ property of the StatusData class from int type to Number.

    Cheers, Martijn.

    comment-bottom
  31. Atimoda says:

    Great class man. I’m starting to work with it in a project.

    There is an problem to fix in your Air example:
    you’ve changed the “browserAuth” with “useAuthHeaders”, so a lot of people will get crazy (like me) trying to mind why the autentication dont work properly :D

    Thanks for your work.

    comment-bottom
  32. stowns says:

    Can you please give an example of what needs to be edited with-in the proxy file (if anything) to use the getUserTimeline() method in a pure AS3 on the web swf. I’ve tried to edit your Example.as by changing getPublicTimeline() to get userTimeLine() and can’t get it to work. My .swf always displays the public timeline no matter what. Any help would be AWESOME! Thanks in advance

    http://www.redsixmedia.net/tweetTest.html

    comment-bottom
  33. Jorge says:

    I laughed reading the guy claiming the name.

    comment-bottom
  34. Hemanth says:

    Any idea as to how to over come the cross domain problem for building desktop client app using ur library?

    comment-bottom
  35. broem says:

    Hi Sandro,
    i’m getting this error when i try to place a tweet with the following code (wich should be right):
    Any suggestions ?

    /statuses/update.xml
    This method requires a POST.

    package {

    import flash.display.*;

    import flash.net.navigateToURL;

    import com.swfjunkie.tweetr.Tweetr;
    import com.swfjunkie.tweetr.events.TweetEvent;
    import com.swfjunkie.tweetr.data.objects.StatusData;

    public class Main extends MovieClip {
    public function Main():void {

    //create a new tweetr instance
    var tweetr:Tweetr = new Tweetr();

    // add your login credentials
    tweetr.username=”thisIsNotAUserName”;
    tweetr.password=”herecomesmypassword”;

    // add some event listeners for when a request succeeds or fails
    tweetr.addEventListener(TweetEvent.COMPLETE, handleResult);
    tweetr.addEventListener(TweetEvent.FAILED, handleFail);

    // now send your tweet
    tweetr.sendTweet(“my test tweet”);

    //tweetr.search(“pv3d”);

    }
    public function handleResult(event:TweetEvent):void {
    trace(“s6!”);
    }
    public function handleFail(event:TweetEvent):void {
    trace(“fail!”);
    }
    }
    }

    comment-bottom
  36. Jonathan says:

    Hey Sando,
    I’m building a visual tweeter client (that enables the user easily send pics/vids/swfs with his tweets). I’m basing my work on your great Tweenr lib (thanks!).
    My problem- can’t get the paging (page parameter) work when requesting a friend timeline (nor the count parameter). It Always returns the first page. Any idea?

    Thanks!
    Jonathan

    comment-bottom
  37. Tania says:

    Hi Sandro,

    it works just fine with Mozilla, but not with EI, Safary, Google Chrome and with Opera asks permition to send user data.. Can one do something about it? At least, that the tweerr events are registrated and got response: tweetr.addEventListener(TweetEvent.COMPLETE, handleTweetsLoaded);
    tweetr.addEventListener(TweetEvent.FAILED, handleTweetsFail);

    Thanks!
    Tania

    comment-bottom
  38. Yousef says:

    Hi sandro,

    I am having trouble authenticating, the examples you have posted on Google Code doesnt work either.

    If anyone has successfully implemented authentication in Flash IDE please help as i have been stuck for a week now.

    btw thank you sandro for the open source!

    comment-bottom
  39. Ben Schlein says:

    I am new to swc files so how do I install the one I downloaded from your site?

    comment-bottom
  40. Dwight says:

    I having issues using createFavorite, I keep getting this error “Error opening URL ‘http://twitter.com/favorites/create/'” It seems like it’s not appending the id number on the end of the link. Do you have a working example of this?

    comment-bottom
  41. guido says:

    Hi Sandro

    in the output I get
    Error opening URL ‘http://https://api.twitter.com/1/statuses/user_timeline.xml?hash=dG91cmluZ19tb2JpbGlzOnRtcHc4MDY2′

    So it seems to mix the http with an https… How can I solve this ?

    comment-bottom
  42. guido says:

    Hi Sandro.
    I forgot to import a certain library , which is why I got that error. Solved.
    But still I can’t get any Tweet display in flash. So I have been checking the getUserTimeLine method and added some traces in it.

    Code :
    public function getUserTimeLine(id:String = null, since_id:String = null, since_date:String = null, max_id:Number = 0, page:Number = 0):void
    {

    trace (“request = ” , request);
    urlLoader.load(url);
    }

    From the Flash Output I got :
    request = /statuses/user_timeline.xml

    I would assume that in the request sting the username should be concatenated …

    comment-bottom
  43. Sandro says:

    Hi Guido

    It would probably be easier if you would post your problem over at the google groups site at: http://groups.google.com/group/tweetr-as3-library/.

    Thanks,
    Sandro

    comment-bottom
  44. […] http://blog.swfjunkie.com/2009/03/updated-tweetr-as3-library/ เวบของเจ้าของ Tweetr ครับลองคุยกับเขาดู […]

    comment-bottom
  45. al says:

    Hi, awesome library, very nice of you to make this open source. I am integrating this into an AIR app I have, tweetr.getUserTimeLine() works great but I can’t seem to get tweetr.search() working. Code is below, let me know if you have any ideas, thanks.
    __________________________

    package {

    import flash.events.Event;
    import flash.display.MovieClip;
    import com.swfjunkie.tweetr.events.TweetEvent;
    import com.swfjunkie.tweetr.utils.TweetUtil;
    import com.swfjunkie.tweetr.data.objects.StatusData;
    import com.swfjunkie.tweetr.data.objects.SearchResultData;
    import com.swfjunkie.tweetr.Tweetr;

    public class twitter extends MovieClip
    {

    public function twitter():void
    {
    // create a tweetr instance
    tweetr = new Tweetr();
    tweetr.useAuthHeaders = true;

    // pass the username & password
    tweetr.username = “my username”;
    tweetr.password = “my password”;

    // add some eventlisteners
    tweetr.addEventListener(TweetEvent.COMPLETE, handleTweetsLoaded);
    tweetr.addEventListener(TweetEvent.FAILED, handleTweetsFail);
    say_button.addEventListener(MouseEvent.CLICK, Speak_Tweet_Event);

    //tweetr.getUserTimeLine();
    tweetr.search(“gadgets”);
    }

    private function handleTweetsLoaded(event:TweetEvent):void
    {
    // assign the latest response to a data object
    var tweet:StatusData = event.responseArray[0] as StatusData;
    text.text = “@”+tweet.user.screenName + tweet.text + ” ” + TweetUtil.returnTweetAge(tweet.createdAt);

    }

    private function handleTweetsFail(event:TweetEvent):void
    {
    trace (“Tweet Called Failed”);

    }

    }
    }

    comment-bottom
  46. enporte says:

    Hi,
    I downloaded 1.0b3 swc just now, and tried to use FlexExampleTwo. However, I got these errors:

    “1059:Property is read-only”
    “1119: Access of possibly undefined property password through a reference with static type com.swfjunkie.tweetr:Tweetr.”

    It seems that in the swc there is no “set username” or “set password” method. Am I missing anything?

    Thanks.

    comment-bottom
  47. Sandro says:

    As of 1.0.b3 setting username and password is not provided anymore.
    Only get username still exists. This is due twitters deprecation of
    the basic authentication process. In order to prevent people from
    using it, it has been completely remove in the latest release.

    The examples are not up to date with this change though, except for
    the oauth examples which i blogged about.here:


    http://blog.swfjunkie.com/2010/08/tweetr-v1-0b3-out/

    Greets,
    Sandro

    comment-bottom
  48. Charles says:

    Hi,

    This is a great library. I’m using it with Adobe AIR. I just wanted to provide some feedback on OAUTH with Twitter. Right now in this library I don’t think there is any sort of event handling when a user deny’s access to twitter via the HTMLLoader, unless I missed an event listener somewhere.

    I came up with a way to know if the user clicks the Deny button, but it isn’t very clean. It involves listening to the HTMLLoaders Event.COMPLETE event, then examining the current URL, and tacking on a javascript function to callback to the actionscript code when deny is clicked.

    The page that asks for credentials with the Allow or Deny buttons is: http://twitter.com/oauth/authorize

    You can use the following in the HTMLLoaders Event.COMPLETE event handler to look for that page, then grab the instance of the Deny button and add the javascript function to it. My HTMLLoader is called “loginBrowserInstance”.

    if ( loginBrowserInstance.location.indexOf(‘http://twitter.com/oauth/authorize’) == 0 ) {

    if ( loginBrowserInstance.window.document.getElementById(“deny”) ) {
    trace(“Setting javascript items on twitter page”);
    loginBrowserInstance.window.handleDenyCallFromJavaScript = this.handleDenyCallFromJavaScript;
    loginBrowserInstance.window.document.getElementById(“deny”).setAttribute(“onclick”, “window.handleDenyCallFromJavaScript(); return true”);
    }
    }

    private function handleDenyCallFromJavaScript():void {
    trace(“the deny button was pressed”);
    }

    comment-bottom
  49. Sangman says:

    Hi,

    First of all I think this library could prove very useful… but I can’t seem to get it working. I’m following the OAuth tutorial now but when I do just this:

    var tweetr:Tweetr = new Tweetr();
    var oauth:OAuth = new OAuth(); tweetr.addEventListener(TweetEvent.COMPLETE, HandleTweetEvent); tweetr.addEventListener(TweetEvent.FAIL, HandleTweetEvent);
    oauth.addEventListener(OAuthEvent.COMPLETE, HandleOAuthEvent); oauth.addEventListener(OAuthEvent.ERROR, HandleOAuthEvent);

    Flash (CS5, btw) gives me error messages related to the use of CONFIG::AIR and CONFIG::WEB, like this one:
    C:\[…]\com\swfjunkie\tweetr\oauth\OAuth.as, Line 19 1120: Access of undefined property AIR.

    Don’t really know what to do about this…

    comment-bottom
  50. sixfngers says:

    I get the same errors regarding the CONFIG:: I see that they suggest using the swc instead of the source. How do you use the swc file i included it in my library but the compiler gives me the error like i didnt import the class. when i do import the class it gives me the CONFIG error

    comment-bottom
  51. sixfngers says:

    nm i still had the source files in my com folder so I think flash was using those over the swc i deleted teh swfjunkie folder and all is well. Excellent work.

    comment-bottom
  52. nite says:

    hi sandro
    nice work
    i am trying to update status with tweetr and flash
    but it is not happening. i converted flex example into flash
    but something is wrong

    im getting tweetr.username is read only
    tweetr.password is undefined property

    package
    {
    import com.adobe.viewsource.ViewSource;
    import com.swfjunkie.tweetr.Tweetr;
    import com.swfjunkie.tweetr.data.objects.StatusData;
    import com.swfjunkie.tweetr.events.TweetEvent;
    import com.swfjunkie.tweetr.utils.TweetUtil;
    import flash.events.*;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.filters.DropShadowFilter;
    import flash.text.StyleSheet;
    import flash.text.TextField;
    //import mx.controls.Alert;
    import flash.net.navigateToURL;

    [SWF(frameRate = “24”,backgroundColor = “0x666666″)]

    public class Update extends Sprite
    {
    private var tweetr:Tweetr;
    private var tweetId:Number;
    public function Update()
    {
    ViewSource.addMenuItem(this, “srcview/index.html”);
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
    init();
    }
    private function init():void
    {
    tweetr = new Tweetr();
    tweetr.serviceHost = “labs.swfjunkie.com/tweetr/proxy”;

    tweetr.addEventListener(TweetEvent.COMPLETE, handleLoad);
    tweetr.addEventListener(TweetEvent.FAILED, handleFail);

    submitbtn.addEventListener(MouseEvent.CLICK, sendTweet);
    submitbtn.buttonMode = true;
    // tweetr.getPublicTimeLine();
    }

    private function handleLoad(event:TweetEvent):void
    {
    //stack.selectedIndex = 1;
    tweetId = StatusData(event.responseArray[0]).id;
    }
    private function handleFail(event:TweetEvent):void
    {
    trace(event.info,”Epic Fail”);
    // Alert.show(event.info,”Epic Fail”);
    }
    private function sendTweet(e:MouseEvent):void
    {
    // make sure we got a username and
    // password before sending the tweet out.
    if (username_txt.text != “” && pass_txt.text != “”)
    {
    //trace(“hhh”,tweetr.username,username_txt.text)
    tweetr.username = username_txt.text;
    tweetr.password = pass_txt.text;
    tweetr.updateStatus(status_txt.text);
    }
    else
    {
    trace(“Username & Password required for this example! Don’t worry, they won’t get saved.”);
    // Alert.show(“Username & Password required for this example! Don’t worry, they won’t get saved.”);
    }
    }

    // private function goToTweet():void
    // {
    // navigateToURL(new URLRequest(“http://twitter.com/”+username.text+”/status/”+tweetId),”_blank”);
    // }
    //
    //
    //
    }

    }

    comment-bottom
  53. I’m trying to find out how to extract the screen name returned by a successful post.
    like;
    trace(“@”+event.responseArray[0].user.name+” wrote:

    This returns my name, not my ScreenName.
    What do I do to get my Screen Name. ie; @ShanghaiTimes
    thanks
    Robert

    comment-bottom
  54. First of all it is a very cool libs and i’ve encountered a problem which is i can’t make it logout and login again, always stuck at authorization page. Can anybody help me ?

    comment-bottom
  55. These are truly fantastic ideas in concerning blogging.

    You have touched some nice things here. Any way keep up
    wrinting.

    comment-bottom
  56. Hello folks on this videos I am just likely to exhibit
    u how to get a free minecraft premium account in A moment.
    Now i am not likely to write the web-site
    in this case given that u can see it in the video.
    That is a straightforward tutorial that doesn’t takes a lot more than Five minutes of time.
    If you are a admirer of minecraft and you want a premium account, you can actually pick up this right now !

    This particular Web-site Offers you free minecraft premium accounts.

    In case you really would like a minecraft premium account for free check out it, and follow
    the guide, it’s be sure you will definitely get 1 working accounts.

    You may use that minecraft premium account in tekkit, bukkit and vanilla server.
    It’s amazing.

    Feel free to surf to my webpage – Pokemon X et Y Gratuitment

    comment-bottom
  57. G-B says:

    Cet article est rempli &X64;e b&X6F;ns co&X6e;seils

    Feel free t&X6f; surf tо my web blog – G-B

    comment-bottom
  58. Web Site says:

    Un article vraiment plein de vérités

    My blog :: Web Site

    comment-bottom
  59. Јe prends la peine de publier un commentaire simρlement pouur féliciter
    l’auteur

    Ϻy wеb site: X, http://www.videos-pornographique-xxxx.eu,

    comment-bottom
  60. website says:

    Рost follement intéressant

    Also visit mmy web site :: website

    comment-bottom
  61. Lawerence says:

    Bon, jje n’аi guère terminé de regarder toutefois je repasserai ce soir

    Here is my weblog :: scènе magnifiquement choquante de qualité d’une femme mature adorablement bitch
    (Lawerence)

    comment-bottom
  62. Viѵement un autre post

    Also vsit my homepage amatrice camionneuse

    comment-bottom
  63. homepage says:

    Vachеment fascinant, selon moii cе ρoste intéresserait ma pote

    comment-bottom
  64. J’ai guère terminé de lire toutefois јe passerai dans lа journée

    comment-bottom
  65. Je pеux dire que c’eѕt clairement de la joie de passеr sur votre site internet

    comment-bottom
  66. No other information required, no hassles, and no strings affixed.
    The risk is out there in both the real world and online.
    Certainly to take all your unfastened PSN Requirements, a number of you will want you should need to do
    is currently cue into adulthood In terms of membership to Descriptions2Boutique
    on to receive explanations from your no actual payment gifts.

    The largest news in recent times was Hewlett-Packard (HPQ
    – Analyst Report) getting the final approval from the European Union regarding its acquisition of 3Com.
    color_button); ad_url = param_concat_escape(ad_url, ‘cl_button_text’,
    unit. Not every first-rate game is made on a disc, there are some long and epic, short and sweet,
    and completely unique and fun downloadble games to purchase on the Playstation Network.
    Offered you are prudent with your shots, and maintain fulfilling
    challenges and optional objectives, you rapidly amass not only ample ammunition but also a seriously powerful arsenal as nicely.

    Feel free to surf to my homepage: telecharger criminal case hack gratuit

    comment-bottom
  67. Spot on with this write-up, I truly believe this amazing site needs a great deal more attention. I’ll probably be
    back again to read more, thanks for the info!

    comment-bottom
  68. Articlе incrfoyablement attrayant !

    comment-bottom
  69. Keeρ on working, ցreat job!

    Αlso visit my homepage :: Télécharger minecraft gratuit

    comment-bottom

RSS feed for comments on this post | TrackBack URL

Leave a comment

Flash Flex Actionscript Tutorials Tutorial AS2 AS3 AS1 Feeds MXML Blog Zinc AIR Launcher Twitter Tweetr Yet Another Coverflow Liip Adobe Macromedia PHP MySQL PostgreSQL XML AMF MXNA Phidgets Schweiz Switzerland Suisse Svizzera Fribourg Freiburg Aargau Baden Publicis Accessibility JAcc Qt FOSDR Flash on the Beach Forum Conference Speaker Speaking Talk