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の検索結果を表示

Get Adobe Flash player
by umhr 11 Mar 2012
    Embed
/**
 * Copyright umhr ( http://wonderfl.net/user/umhr )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/rmEU
 */

package {
    import flash.display.AVM1Movie;
    import flash.display.Loader;
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.easing.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            var url:URLRequest = new URLRequest("http://search.twitter.com/search.atom?q=apple");
            var loader:URLLoader = new URLLoader(url);
            loader.addEventListener(Event.COMPLETE, loader_complete);
            
        }
        private function loader_complete(event:Event):void 
        {
            var myXML:XML = XML(event.target.data);
            
            default xml namespace = new Namespace("http://www.w3.org/2005/Atom");
            
            // myXML.entry[0].author.name
            // myXML.entry[0].title;
            // myXML.entry[0].link[1].@href
            var n:int = myXML.entry.length();
            
            for (var i:int=0; i<n; i++) {
                var tf:TextField = new TextField();
               tf.htmlText = "<img src='" + myXML.entry[i].link[1].@href + "'>";
               tf.htmlText += "<b>" + myXML.entry[i].author.name + "</b>";
               tf.htmlText += " : ";
               tf.htmlText += myXML.entry[i].title;
                //tf.text = "<font color='#FF0000'>ABC</font>";
                tf.width = 464;
                tf.height = 60;
                tf.border = true;
                tf.borderColor = 0xFF0000;
                tf.background = true;
                tf.backgroundColor = 0xFFCCCC;
                if(i%2 == 0){
                    tf.backgroundColor = 0xCCCCFF;
                }

                tf.wordWrap = true;
                tf.y = 0;
                addChild(tf);
                BetweenAS3.to( tf, { y:65*i },2,Back.easeOut ).play();
            }
            
        }
    }
}