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

under the stars

Get Adobe Flash player
by Dorara 31 Aug 2010
/**
 * Copyright Dorara ( http://wonderfl.net/user/Dorara )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/HOaL
 */

package {
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.easing.Back;

    public class HosizoraViewer extends Sprite
    {
        public var mrss:MediaRSSLoader;
        public var dataField:TextField;
        public var StartFlg:Boolean;
        public var spArray:Array;
        public var backSp:Sprite;
        public var prvModeFlg:Boolean;
        public var Width:int, Height:int;
        
        public function HosizoraViewer()
        {
            this.stage.scaleMode = StageScaleMode.NO_SCALE;
            this.stage.align = StageAlign.TOP_LEFT;
            
            mrss = new MediaRSSLoader("littlebigplanet");
            spArray = new Array();
            StartFlg = false;
            Width = this.stage.stageWidth;
            Height = this.stage.stageHeight;
            
            backSp = new Sprite();
            backSp.graphics.beginFill(0x000000);
            backSp.graphics.drawRect(0, 0, Width+1, Height+1);
            backSp.graphics.endFill();
            backSp.graphics.beginFill(0xffffff);
            for(var i:int = 0; i<30; i++){
                backSp.graphics.drawCircle(Width * Math.random(), Height * Math.random(), 1);
            }
            backSp.graphics.endFill();
            this.addChild(backSp);
            dataField = new TextField();
            dataField.height = 16;
            dataField.textColor = 0xffffff;
            this.addChild(dataField);
            this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        
        public function onClick(e:MouseEvent):void{
            if(!prvModeFlg){
                prvModeFlg = true;
                this.setChildIndex(e.target as Sprite, this.numChildren-1);
                BetweenAS3.tween(e.target, {x:0, y:0, width:Width+1, height:Height+1}, null, 0.8, Back.easeOut).play();
            }else{
                BetweenAS3.tween(e.target, {x:Width+1 ,y:255 , width:50, height:50}, null, 0.5).play();
                prvModeFlg = false;
            }        
        }
        public function onEnterFrame(e:Event):void
        {
            if(!StartFlg){
                if(mrss.flag){
                    dataField.text = "loading.." + mrss.compN.toString() + "/" + mrss.bmps.length.toString();
                    if(mrss.compN==(int)(mrss.bmps.length)){
                        for(var i:int = 0; i<20; i++){
                            var sp:Sprite = new Sprite();
                            mrss.bmps[i].width = 120 * Math.random() + 30;
                            mrss.bmps[i].height = mrss.bmps[i].width;
                            sp.mouseChildren = false;
                            sp.addChild(mrss.bmps[i]);
                            sp.x = -150;//(i%5) * 150;
                            sp.y = (Height - 50) * Math.random();//(int)(i/5) * 150;
                            spArray.push(sp);
                            spArray[i].addEventListener(MouseEvent.CLICK, onClick);
                            this.addChild(sp);
                        }
                        StartFlg = true;
                        dataField.text = "";
                        prvModeFlg = false;
                    }
                }
            }else{
                if(!prvModeFlg){
                    for(i = 0; i<20; i++){                
                        spArray[i].x += spArray[i].width/50.0;
                        if(spArray[i].x > Width+150){
                            spArray[i].x = -150;
                            spArray[i].y = (Height - 50) * Math.random();
                            spArray[i].width = spArray[i].height = 120 * Math.random() + 30;
                        }
                    }
                }
            }
        }
    }
}



import flash.net.URLRequest;
import flash.events.Event;
import flash.net.URLLoader;
import flash.system.Security;
import flash.display.*;
class MediaRSSLoader{
    private var _feed:String = "http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&tags=";
    private var media:Namespace = new Namespace("http://search.yahoo.com/mrss/");
    public var bmps:Array;
    public var flag:Boolean;
    public var compN:int;
    public function MediaRSSLoader(_tag:String) {
        bmps = new Array();
        compN = 0;
        flag = false;
        
        Security.loadPolicyFile("http://farm5.static.flickr.com/crossdomain.xml");
        
        var ldr:URLLoader = new URLLoader;
        ldr.addEventListener(Event.COMPLETE, function _load(e:Event):void {
            ldr.removeEventListener(Event.COMPLETE, _load);
            onImageLoaded(XML(ldr.data)..media::content.@url.toXMLString().split('\n'));
        });
        ldr.load(new URLRequest(_feed+_tag));
    }
        
    private function onImageLoaded($images:Array):void {
        var container:Sprite = new Sprite;
        var ldr:Loader;
        for (var i:int = 0; i < $images.length; ++i) {
            ldr = new Loader;
            ldr.load(new URLRequest($images[i]));
            ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, function _loadimage(e:Event):void{
                compN++;
            });
            ldr.x = 0;
            ldr.y = 0;
            bmps.push(ldr);
        }
        flag = true;
    }
}