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

Game Keep The Cute Doll

Get Adobe Flash player
by heart_thai 21 Aug 2009
/**
 * Copyright heart_thai ( http://wonderfl.net/user/heart_thai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gltW
 */

package {
    import flash.display.*;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.events.*;
    import flash.utils.Timer;
    import flash.net.URLRequest;
    import flash.text.TextFormat;

    
    
    [SWF(backgroundColor="#FFFFFF")]
    public class ZooMatch extends Sprite {
        
        private var w:Number = 5;
        private var h:Number = 5;
        //private var items:Array;
        private var basket:Loader;
        private var scr:TextField;
        private var score:Number = 0;
         private var tf:TextFormat;
        
        public function ZooMatch() {
           // items = new Array();
           
           
            var tm:Timer = new Timer(1500);
            tm.addEventListener(TimerEvent.TIMER , create );
            tm.start();
            
            var bg:Loader = new Loader();
            bg.load(new URLRequest("http://www.howdoflash.net/share/garden.jpg"));
      
            addChild(bg);
            
            var bar:Loader = new Loader();
            bar.load(new URLRequest("http://www.howdoflash.net/share/bar.png"));
            addChild(bar);
            bar.y = 50;
            
            bg.scaleY = 1.3;
            basket = new Loader();
            addChild(basket);
            basket.load(new URLRequest("http://www.howdoflash.net/share/basket.png"));
            basket.y = 390;
            basket.addEventListener(Event.ENTER_FRAME ,followMouse);
            scr = new TextField();
            tf = new TextFormat();
            scr.text = "0";
            tf.font ="Arial";
            tf.size = 35;
            tf.color = 0xFF0066;
            scr.setTextFormat(tf);
            addChild(scr);
        }
        private function followMouse(e:Event):void{
            var sx:Number = (mouseX-50)-e.target.x;
            e.target.x += sx/10;
        }
        private function create(e:TimerEvent):void{
           var c:Cell = new Cell();
           c.addEventListener(Event.ENTER_FRAME , run);
           c.y = 120;
           c.x = -100;
           c.buttonMode = true;
         //  items.push(c);
          c.toX = Math.random()*stage.stageWidth;
           addChild(c);    
        }
        private function fx(e:Event):void{
           var n:Num = e.target as Num;
           n.alpha -=0.05;
           n.y -= 3;    
           if(n.alpha<=0){
            n.removeEventListener(Event.ENTER_FRAME , fx);   
            removeChild(n);
            n = null;
            }
        }
        private function run(e:Event):void{
            var c:Cell = e.target as Cell;
           
            if(c.x >= c.toX){
                 c.y += c.spd;
                 c.spd += 1;
                 c.rotation += c.swing;
                 if(c.hitTestObject(basket)){
                     var n:Num = new Num();
                     addChild(n);
                     n.addEventListener(Event.ENTER_FRAME , fx);
                     n.x = c.x; 
                     n.y = c.y+50;
                     score += 15;
                     scr.text = score.toString();
                     scr.setTextFormat(tf);
                     c.removeEventListener(Event.ENTER_FRAME , run); 
                     removeChild(c);
                     c = null;
                 }
            }else{
               c.x += 5;    
            }
            if(c.x > 500){
                c.removeEventListener(Event.ENTER_FRAME , run); 
                removeChild(c);
                c = null;
            }else if(c.y > 800){
                c.removeEventListener(Event.ENTER_FRAME , run); 
                removeChild(c);
                c = null;
           }
        }
     }
}


import flash.net.URLRequest;
import flash.display.*;


class Cell extends Sprite{
    private var icon:Array;
    public var toX:Number;
    public var spd:Number;
    public var swing:Number;
    public function Cell(){
        icon = [
        "http://farm3.static.flickr.com/2608/3839475460_66c5e7637e_o.png",
        "http://farm4.static.flickr.com/3467/3839485958_a7572aeb61_o.png",
        "http://farm3.static.flickr.com/2440/3838696725_a921833d70_o.png",
        "http://farm3.static.flickr.com/2650/3839496010_96de330537_o.png",
        "http://farm3.static.flickr.com/2444/3839495982_12d0e4ecc8_o.png",
        "http://farm3.static.flickr.com/2608/3839475460_66c5e7637e_o.png",
        "http://farm3.static.flickr.com/2608/3839475460_66c5e7637e_o.png",
        "http://farm4.static.flickr.com/3467/3839485958_a7572aeb61_o.png",
        "http://farm3.static.flickr.com/2440/3838696725_a921833d70_o.png",
        "http://farm3.static.flickr.com/2650/3839496010_96de330537_o.png",
        "http://farm3.static.flickr.com/2444/3839495982_12d0e4ecc8_o.png",
        "http://farm3.static.flickr.com/2608/3839475460_66c5e7637e_o.png"
        ];
        spd = -10;
        swing = (Math.random()*10)-5;
        var type:Number = Math.round(Math.random()*icon.length);
        var  ld:Loader = new Loader();
        ld.load(new URLRequest(icon[type]));
        ld.scaleX = ld.scaleY = .35;
        addChild(ld);
    }
}

    import flash.display.*;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.events.*;
    import flash.utils.Timer;
    import flash.net.URLRequest;
    import flash.text.TextFormat;
class Num extends Sprite{

   public function Num(){
        var t:TextField = new TextField();
        addChild(t);
        t.text = "+15";
        var tf:TextFormat  = new TextFormat();
           tf.font ="Arial";
           tf.size = 35;
           tf.color = 0x33CCFF;
           t.setTextFormat(tf);
    }
}