In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Tweet Button

@author Takashi Murai (KAYAC)
/**
 * Copyright Murai ( http://wonderfl.net/user/Murai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/hU0w
 */

package {
    import com.bit101.components.*;

    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.net.URLRequest;
    import flash.net.navigateToURL;
    import flash.utils.escapeMultiByte;

    /**
     * @author Takashi Murai (KAYAC)
     */    
    [SWF(backgroundColor="#33ccff", frameRate="60", width="465", height="465")]

    public class TweetTest extends Sprite {

        private var tweetButton:PushButton;

        public function TweetTest() {
            // write as3 code here..
            addChild(tweetButton = new PushButton(this, 0, 0, "Tweet!"));
            tweetButton.width = 200;
            tweetButton.height = 100;
            tweetButton.x = 465 / 2 - tweetButton.width/2;
            tweetButton.y = 465 / 2 - tweetButton.height/2;
            
            tweetButton.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
                navigateToURL(new URLRequest("http://twitter.com/share?text=" + escapeMultiByte("flash tweet button test. #wonderfl") + "&url=" + escapeMultiByte("http://level0.kayac.com/2010/08/flash_default_tweet_button.php") + "&via=" + escapeMultiByte("vesperworks")));
            });
        }
    }
}