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

twitter post test

Twitter投稿機能テスト
Get Adobe Flash player
by whirlpower 01 Mar 2010
/**
 * Copyright whirlpower ( http://wonderfl.net/user/whirlpower )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/uUEA
 */

package
{
    import flash.display.Sprite;
	import flash.net.*;
	import flash.utils.escapeMultiByte;
	import flash.events.*;
    import com.bit101.components.*;
    
    /*
     * Twitter投稿機能テスト 
     */
    [SWF(backgroundColor=0xeeeeee, width=465, height=465)]
    public class FlashTest extends Sprite
    {
    	// twitterのurl
		private var twitter	:String = "http://twitter.com/home?status=";
		
		// メッセージ
		private var message	:String = "post message";
		
		// 誘導したいurl
		private var targetURL:String = "http://wonderfl.net/";
		
		// ハッシュタグ
		private var hashTag	:String =  "%23test"
		
		// ボタン
		private var button:PushButton;		
		
        public function FlashTest()
        {
        		button = new PushButton( this, 200, 200, "post")
	        button.addEventListener( MouseEvent.CLICK, clickHandler );
        }
		
		/**
		 * クリック
		 * @param	e
		 */
        private function clickHandler( e:MouseEvent ):void
        {
	        postTweet();
        }
        
		/**
		 * Twitterのサイトに行き、ポストする用意をする。
		 */
		private function postTweet():void
		{
			navigateToURL( new URLRequest( twitter + escapeMultiByte( message ) + " " + targetURL + " " + hashTag ) );
		}
    }
}