※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


forked from : miyaoka's SporeLaneCamera [diff(100)]

FORKED
  1. // forked from miyaoka's SporeLaneCameraSnap
  2. package 
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.events.Event;
  6.     import flash.geom.Matrix;
  7.     import flash.net.URLLoader;
  8.     import flash.net.URLRequest;
  9.     import flash.events.MouseEvent;
  10.     import flash.filters.GlowFilter;
  11.     import flash.ui.Mouse;
  12.     import caurina.transitions.Tweener;
  13.     import flash.display.GradientType;
  14.     import flash.media.Sound;
  15.     import flash.display.BitmapData;
  16.     import flash.display.Bitmap;
  17.     import flash.filters.DropShadowFilter;
  18.     import flash.system.Security;
  19.     [SWF(width="465", height="465", backgroundColor= 0xffffff, frameRate="60")]
  20.     public class SporeLane
  21.     extends Sprite
  22.     {
  23.         // our search types:
  24.         public var mQueries:Array = new Array("FEATURED""RANDOM""TOP_RATED""TOP_RATED_NEW""NEWEST""CUTE_AND_CREEPY""MAXIS_MADE");
  25.         // a loader for the query
  26.         public var mLoader:URLLoader;
  27.         
  28.         public var mServerString:String = "http://www.spore.com";
  29.         public var mCurrentQueryString:String = "";
  30.         public var mCurrentQuery:Number = Math.floor(Math.random()*mQueries.length);
  31.         public var mStartIndex:Number = 0;
  32.         public var mCount:Number = 50;
  33.         
  34.         private var lane:Lane;
  35.         private var focus:Sprite;
  36.         private var shutter:Sprite;
  37.         private var bg:Sprite;
  38. /*
  39. camera sound by SFX Bible on soundSnap
  40. http://www.soundsnap.com/node/41248
  41. */
  42.         private var shutterSndURL:String = "http://www.t-p.jp/flash/FOLEY CAMERA TAKE PICTURE 01.mp3";
  43.         private var shutterSnd:Sound;
  44.         
  45.         public function SporeLane():void 
  46.         {
  47.             Security.loadPolicyFile("http://www.t-p.jp/crossdomain.xml");
  48.             //lane
  49.             lane= new Lane();
  50.             lane.laneHeight = 550;
  51.             lane.y = -20;
  52.             //focus
  53.             focus = new Sprite();
  54.             var fx:Number = 48;
  55.             var fy:Number = 36;
  56.             var fr:Number = 6;
  57.             focus.graphics.lineStyle(1.5,0,0.5);
  58.             focus.graphics.moveTo(-fx-fr, -fy);
  59.             focus.graphics.curveTo(-fx-fr, -fy-fr, -fx, -fy-fr);
  60.             focus.graphics.moveTo(fx+fr, -fy);
  61.             focus.graphics.curveTo(fx+fr, -fy-fr, fx, -fy-fr);
  62.             focus.graphics.moveTo(-fx-fr, fy);
  63.             focus.graphics.curveTo(-fx-fr, fy+fr, -fx, fy+fr);
  64.             focus.graphics.moveTo(fx+fr, fy);
  65.             focus.graphics.curveTo(fx + fr, fy + fr, fx, fy + fr);
  66.             focus.graphics.moveTo(-fr, 0);
  67.             focus.graphics.lineTo(fr, 0);
  68.             focus.graphics.moveTo(0, -fr);
  69.             focus.graphics.lineTo(0, fr);
  70.             focus.filters = [
  71.                 new GlowFilter(0xFFFFFF, 0.7,2,2,6)
  72.             ];
  73.             Mouse.hide();
  74.             
  75.             //shutter
  76.             shutter = new Sprite();
  77.             shutter.graphics.beginFill(0);
  78.             shutter.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  79.             shutter.visible = false;
  80.             
  81.             shutterSnd = new Sound(new URLRequest(shutterSndURL));
  82.             //bg
  83.             bg = new Sprite();
  84.             var mtr:Matrix = new Matrix();
  85.             mtr.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI/2);
  86.             bg.graphics.beginGradientFill(
  87.                 GradientType.LINEAR, 
  88.                 [0xEEEEEE, 0xDDDDCC], 
  89.                 [1,1],
  90.                 [0255],
  91.                 mtr
  92.             );
  93.             bg.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  94.             
  95.             //add
  96.             addChild(bg);
  97.             addChild(lane);
  98.             addChild(focus);
  99.             addChild(shutter);
  100.             stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
  101.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  102.             
  103.             //PreLoad mochi
  104.             //achaSpore
  105.             lane.addImg("http://www.t-p.jp/flash/achaSpore128.png");
  106.             //achamo
  107.             lane.addImg("http://www.t-p.jp/flash/Achamo128.png");
  108.             //mochi
  109.             lane.addImg("http://www.t-p.jp/flash/mochi128.png");
  110.             
  111.             // initiate the query
  112.             mLoader = new URLLoader();
  113.             mLoader.addEventListener(Event.COMPLETE, GotData);
  114.             GetSpecialFeed(mQueries[mCurrentQuery], mStartIndex, mCount); 
  115.         }
  116.         private function mouseMoveHandler(e:MouseEvent):void 
  117.         {
  118.             focus.x = mouseX;
  119.             focus.y = mouseY;
  120.         }
  121.         private function mouseDownHandler(e:MouseEvent):void 
  122.         {
  123.             //film
  124.             var bd:BitmapData = new BitmapData(120,90);
  125.             bd.draw(bg, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  126.             bd.draw(lane, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  127.             
  128.             var film:Film = new Film(bd);
  129.             film.addEventListener(Event.ENTER_FRAME, filmThrow,false,0,true);
  130.             film.x = mouseX;
  131.             film.y = mouseY;
  132.             addChild(film);
  133.             
  134.             //shutter
  135.             shutter.y = -shutter.height;
  136.             shutter.visible = true;
  137.             setChildIndex(shutter, numChildren - 1);
  138.             
  139.             shutterSnd.play();
  140.             Tweener.addTween(shutter, {
  141.                 y:0,
  142.                 time:0.03,
  143.                 transition: "linear",
  144.                 onComplete: function():void {
  145.                     Tweener.addTween(shutter, {
  146.                         y:-shutter.height,
  147.                         time:0.03,
  148.                         transition: "linear",
  149.                         onComplete: function():void {
  150.                             shutter.visible = false
  151.                         }
  152.                     });
  153.                 }
  154.             });
  155.             
  156.         }
  157.         private function filmThrow(e:Event):void 
  158.         {
  159.             var film:Film = e.target as Film;
  160.             film.x += film.moveX;
  161.             film.y += film.moveY;
  162.             
  163.             film.moveY += 0.2;
  164.             if (film.y - film.height > stage.stageHeight) 
  165.             {
  166.                 removeChild(film);
  167.                 film.removeEventListener(Event.ENTER_FRAME, filmThrow);
  168.                 film = null;
  169.             }
  170.         }
  171.         public function GetSpecialFeed(feed:String, startIndex:Number, numAssets:Number):void
  172.         {
  173.             var queryString:String = mServerString + "/rest/assets/search/" + feed + "/" + startIndex + "/" + numAssets;
  174.             mLoader.load(new URLRequest(queryString));            
  175.         }
  176.         public function GotData(e:Event):void
  177.         {
  178.             var dataXML:XML = new XML(e.target.data);
  179.             
  180.             // Parse the XML
  181.             namespace atomenv = "http://www.w3.org/2005/Atom";
  182.             use namespace atomenv;
  183.             
  184.             var counter:Number = 0;
  185. //            trace(dataXML);
  186.             for each (var asset:XML in dataXML..asset)
  187.             {
  188.                 var id:String = asset..id.toString();
  189.                 GetSmallPNG(id);
  190.                 counter++;
  191.                 if(counter == mCount)
  192.                 {
  193.                     break;
  194.                 }
  195.             }
  196. //            mStatusText.text = "Loaded query: " + mCurrentQueryString;
  197.             
  198.         }        
  199.         
  200.         public function GetSmallPNG(assetId:String):void
  201.         {
  202.             var subId1:String = assetId.substr(0,3);
  203.             var subId2:String = assetId.substr(3,3);
  204.             var subId3:String = assetId.substr(6,3);
  205.             var smallPNGURL:String = "http://www.spore.com/static/thumb/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + ".png"
  206.             //var smallPNGURL:String = "http://www.spore.com/static/image/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + "_lrg.png"
  207.             
  208.             lane.addImg(smallPNGURL);
  209.         }
  210.     }
  211. }
  212.     
  213. import flash.display.Loader;
  214. import flash.display.LoaderInfo;
  215. import flash.display.Sprite
  216. import flash.events.MouseEvent;
  217. import caurina.transitions.Tweener;
  218. import flash.net.URLRequest;
  219. import flash.events.Event;
  220. import flash.system.LoaderContext;
  221. import flash.geom.Rectangle;
  222. import flash.filters.BlurFilter;
  223. class Lane
  224. extends Sprite 
  225. {
  226.     private var imgContainer:Sprite = new Sprite();
  227.     public var laneWidth:Number = 465;
  228.     public var laneHeight:Number = 465;
  229.     
  230.     
  231.     public function Lane():void 
  232.     {        
  233.         addEventListener(Event.ADDED_TO_STAGE, init);
  234.     }
  235.     private function init(e:Event):void 
  236.     {
  237.         removeEventListener(Event.ADDED_TO_STAGE, init);
  238.         addChild(imgContainer);        
  239.         stage.addEventListener(Event.ENTER_FRAME, setBlurs);
  240.     }
  241.     public function addImg(url:String):void 
  242.     {
  243.         var cell:ImgCell = new ImgCell(url);
  244.         cell.x = Math.random() * laneWidth;
  245.         imgContainer.addChild(cell);
  246.         cell.addEventListener("loaded", cellLoadCompleteHandler, false0true);
  247.         setDepth(cell);
  248.     }
  249.     private function cellLoadCompleteHandler(e:Event):void 
  250.     {
  251.         var cell:ImgCell = e.target as ImgCell;
  252.         cell.removeEventListener("loaded", cellLoadCompleteHandler);
  253.         cell.addEventListener("appeared", cellAppearCompleteHandler, false0true);
  254.     }
  255.     private function setDepth(cell:ImgCell):void 
  256.     {
  257.         var scale:Number = Math.random() + 0.01;
  258.         cell.scaleX = cell.scaleY = scale * 1.4 + 0.2;
  259.         cell.y =  laneHeight * scale;
  260.         sortDepth();
  261.     }
  262.     private function sortDepth():void 
  263.     {
  264.         var num:uint = imgContainer.numChildren;
  265.         var cells:Array = new Array();
  266.         while (num--) cells.unshift(imgContainer.getChildAt(num));
  267.         cells.sortOn("y"Array.NUMERIC);    
  268.         num = cells.length;
  269.         while (num--) imgContainer.setChildIndex(cells[num], 0);
  270.     }
  271.     private function cellAppearCompleteHandler(e:Event):void 
  272.     {
  273.         var cell:ImgCell = e.target as ImgCell;
  274.         cell.removeEventListener("appeared", cellLoadCompleteHandler);
  275.         cell.addEventListener("out", cellOutHandler);
  276.     }
  277.     private function cellOutHandler(e:Event):void 
  278.     {
  279.         var cell:ImgCell = e.target as ImgCell;
  280.         cell.x = laneWidth + cell.width;
  281.         setDepth(cell);
  282.     }
  283.     private function setBlurs(e:Event):void 
  284.     {
  285.         var num:uint = imgContainer.numChildren;
  286.         while (num--) {
  287.             var cell:ImgCell = imgContainer.getChildAt(num) as ImgCell;
  288.             var mx:Number = Math.abs(cell.mouseX) / cell.width;
  289.             var my:Number = Math.abs(cell.mouseY+cell.height/2) / cell.height;
  290.             
  291.             var r:Number = Math.sqrt(mx * mx + my * my);
  292.             if (r < 1) r *=r;
  293.             
  294.             var b:Number = Math.min(100 * cell.scaleX, r *  6 * cell.scaleX);
  295.             
  296.             cell.filters = 
  297.             [
  298.                 new BlurFilter(b,b,1)
  299.             ];
  300.         }
  301.     }
  302. }
  303. import flash.display.BitmapData
  304. import flash.display.Bitmap;
  305. import flash.filters.DropShadowFilter;
  306. import flash.filters.GlowFilter;
  307. class Film
  308. extends Sprite
  309. {
  310.     public var moveX:Number;
  311.     public var moveY:Number;
  312.     public function Film(bd:BitmapData):void 
  313.     {
  314.         var bmp:Bitmap = new Bitmap(bd);
  315.         graphics.beginFill(0xFFFFFF);
  316.         graphics.drawRect( -70, -70140140);
  317.         bmp.x = -60;
  318.         bmp.y = -45;
  319.         rotation = Math.random()*30-15;
  320.         scaleX = scaleY = Math.random()*1+0.5;
  321.         addChild(bmp);
  322.         filters = [
  323.             new DropShadowFilter(width * 0.054500.30, width * 0.15, height * 0.15), 
  324.             new GlowFilter(0xCCCCCC, 1.0, width * 0.04, height * 0.04)
  325.         ];        
  326.         
  327.         moveX = Math.random() * 4 -2;
  328.         moveY = -(Math.random() * 4 + 5);
  329.     }
  330. }
  331. class ImgCell
  332. extends Sprite
  333. {
  334.     private var img:Loader;    
  335.     private var maskSp:Sprite = new Sprite();
  336.     private var hole:Sprite = new Sprite();
  337.     
  338.     public function ImgCell(url:String):void 
  339.     {
  340.         //loader
  341.         img = new Loader();
  342.         img.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
  343.         img.load(new URLRequest(url));
  344.     }
  345.     private function loadCompleteHandler(e:Event):void 
  346.     {
  347.         img.x = -img.width / 2
  348.         maskSp.graphics.beginFill(0);
  349.         maskSp.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  350.         maskSp.graphics.drawRect(-img.width/2, -img.height, img.width, img.height);
  351.         
  352.         hole.graphics.beginFill(0x110909);
  353.         hole.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  354.         hole.y = maskSp.y = 0//-hole.height/2;
  355.         
  356.         img.mask = maskSp;
  357.         
  358.         addChild(hole);
  359.         addChild(img);
  360.         addChild(maskSp);
  361.         //
  362.         visible = true;
  363.         dispatchEvent(new Event("loaded"));
  364.         
  365.         hole.scaleX = hole.scaleY = 0.1;
  366.         Tweener.addTween(hole, {
  367.             scaleX: 1,
  368.             scaleY: 1,
  369.             time: 0.5,
  370.             transition: "easeOutQuint"
  371.         });
  372.         
  373.         img.y = img.height*0.5;
  374.         Tweener.addTween(img, {
  375.             y: -img.height,
  376.             time: 0.2 + Math.random() * 0.5,
  377.             delay:0.1,
  378.             transition: "easeOutCubic",
  379.             onComplete: appearCompleteHandler
  380.         });
  381.     }
  382.     private function appearCompleteHandler():void 
  383.     {
  384.         Tweener.addTween(hole, {
  385.             scaleX: 0.1,
  386.             scaleY: 0.1,
  387.             time: 0.2,
  388.             transition: "easeInQuint",
  389.             onComplete: holeCompleteHandler
  390.         });
  391.     }
  392.     private function holeCompleteHandler():void 
  393.     {
  394.         removeChild(hole);
  395.         removeChild(maskSp);
  396.         img.mask = null;
  397.         hole = maskSp = null;
  398.         dispatchEvent(new Event("appeared"));
  399.         
  400.         addEventListener(Event.ENTER_FRAME, enterFrameHandler, false0true);
  401.     }
  402.     private function enterFrameHandler(e:Event):void 
  403.     {
  404.         x -= width * 0.01;// (Math.random() * 1 + 1) * 0.01;
  405.         if (x + width / 2 < 0) dispatchEvent(new Event("out"));
  406.     }
  407. }
noswf
  1. // forked from miyaoka's SporeLaneCameraSnap
  2. package 
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.events.Event;
  6.     import flash.geom.Matrix;
  7.     import flash.net.URLLoader;
  8.     import flash.net.URLRequest;
  9.     import flash.events.MouseEvent;
  10.     import flash.filters.GlowFilter;
  11.     import flash.ui.Mouse;
  12.     import caurina.transitions.Tweener;
  13.     import flash.display.GradientType;
  14.     import flash.media.Sound;
  15.     import flash.display.BitmapData;
  16.     import flash.display.Bitmap;
  17.     import flash.filters.DropShadowFilter;
  18.     import flash.system.Security;
  19.     [SWF(width="465", height="465", backgroundColor= 0xffffff, frameRate="60")]
  20.     public class SporeLane
  21.     extends Sprite
  22.     {
  23.         // our search types:
  24.         public var mQueries:Array = new Array("FEATURED""RANDOM""TOP_RATED""TOP_RATED_NEW""NEWEST""CUTE_AND_CREEPY""MAXIS_MADE");
  25.         // a loader for the query
  26.         public var mLoader:URLLoader;
  27.         
  28.         public var mServerString:String = "http://www.spore.com";
  29.         public var mCurrentQueryString:String = "";
  30.         public var mCurrentQuery:Number = Math.floor(Math.random()*mQueries.length);
  31.         public var mStartIndex:Number = 0;
  32.         public var mCount:Number = 50;
  33.         
  34.         private var lane:Lane;
  35.         private var focus:Sprite;
  36.         private var shutter:Sprite;
  37.         private var bg:Sprite;
  38. /*
  39. camera sound by SFX Bible on soundSnap
  40. http://www.soundsnap.com/node/41248
  41. */
  42.         private var shutterSndURL:String = "http://www.t-p.jp/flash/FOLEY CAMERA TAKE PICTURE 01.mp3";
  43.         private var shutterSnd:Sound;
  44.         
  45.         public function SporeLane():void 
  46.         {
  47.             Security.loadPolicyFile("http://www.t-p.jp/crossdomain.xml");
  48.             //lane
  49.             lane= new Lane();
  50.             lane.laneHeight = 550;
  51.             lane.y = -20;
  52.             //focus
  53.             focus = new Sprite();
  54.             var fx:Number = 48;
  55.             var fy:Number = 36;
  56.             var fr:Number = 6;
  57.             focus.graphics.lineStyle(1.5,0,0.5);
  58.             focus.graphics.moveTo(-fx-fr, -fy);
  59.             focus.graphics.curveTo(-fx-fr, -fy-fr, -fx, -fy-fr);
  60.             focus.graphics.moveTo(fx+fr, -fy);
  61.             focus.graphics.curveTo(fx+fr, -fy-fr, fx, -fy-fr);
  62.             focus.graphics.moveTo(-fx-fr, fy);
  63.             focus.graphics.curveTo(-fx-fr, fy+fr, -fx, fy+fr);
  64.             focus.graphics.moveTo(fx+fr, fy);
  65.             focus.graphics.curveTo(fx + fr, fy + fr, fx, fy + fr);
  66.             focus.graphics.moveTo(-fr, 0);
  67.             focus.graphics.lineTo(fr, 0);
  68.             focus.graphics.moveTo(0, -fr);
  69.             focus.graphics.lineTo(0, fr);
  70.             focus.filters = [
  71.                 new GlowFilter(0xFFFFFF, 0.7,2,2,6)
  72.             ];
  73.             Mouse.hide();
  74.             
  75.             //shutter
  76.             shutter = new Sprite();
  77.             shutter.graphics.beginFill(0);
  78.             shutter.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  79.             shutter.visible = false;
  80.             
  81.             shutterSnd = new Sound(new URLRequest(shutterSndURL));
  82.             //bg
  83.             bg = new Sprite();
  84.             var mtr:Matrix = new Matrix();
  85.             mtr.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI/2);
  86.             bg.graphics.beginGradientFill(
  87.                 GradientType.LINEAR, 
  88.                 [0xEEEEEE, 0xDDDDCC], 
  89.                 [1,1],
  90.                 [0255],
  91.                 mtr
  92.             );
  93.             bg.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  94.             
  95.             //add
  96.             addChild(bg);
  97.             addChild(lane);
  98.             addChild(focus);
  99.             addChild(shutter);
  100.             stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
  101.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  102.             
  103.             //PreLoad mochi
  104.             //achaSpore
  105.             lane.addImg("http://www.t-p.jp/flash/achaSpore128.png");
  106.             //achamo
  107.             lane.addImg("http://www.t-p.jp/flash/Achamo128.png");
  108.             //mochi
  109.             lane.addImg("http://www.t-p.jp/flash/mochi128.png");
  110.             
  111.             // initiate the query
  112.             mLoader = new URLLoader();
  113.             mLoader.addEventListener(Event.COMPLETE, GotData);
  114.             GetSpecialFeed(mQueries[mCurrentQuery], mStartIndex, mCount); 
  115.         }
  116.         private function mouseMoveHandler(e:MouseEvent):void 
  117.         {
  118.             focus.x = mouseX;
  119.             focus.y = mouseY;
  120.         }
  121.         private function mouseDownHandler(e:MouseEvent):void 
  122.         {
  123.             //film
  124.             var bd:BitmapData = new BitmapData(120,90);
  125.             bd.draw(bg, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  126.             bd.draw(lane, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  127.             
  128.             var film:Film = new Film(bd);
  129.             film.addEventListener(Event.ENTER_FRAME, filmThrow,false,0,true);
  130.             film.x = mouseX;
  131.             film.y = mouseY;
  132.             addChild(film);
  133.             
  134.             //shutter
  135.             shutter.y = -shutter.height;
  136.             shutter.visible = true;
  137.             setChildIndex(shutter, numChildren - 1);
  138.             
  139.             shutterSnd.play();
  140.             Tweener.addTween(shutter, {
  141.                 y:0,
  142.                 time:0.03,
  143.                 transition: "linear",
  144.                 onComplete: function():void {
  145.                     Tweener.addTween(shutter, {
  146.                         y:-shutter.height,
  147.                         time:0.03,
  148.                         transition: "linear",
  149.                         onComplete: function():void {
  150.                             shutter.visible = false
  151.                         }
  152.                     });
  153.                 }
  154.             });
  155.             
  156.         }
  157.         private function filmThrow(e:Event):void 
  158.         {
  159.             var film:Film = e.target as Film;
  160.             film.x += film.moveX;
  161.             film.y += film.moveY;
  162.             
  163.             film.moveY += 0.2;
  164.             if (film.y - film.height > stage.stageHeight) 
  165.             {
  166.                 removeChild(film);
  167.                 film.removeEventListener(Event.ENTER_FRAME, filmThrow);
  168.                 film = null;
  169.             }
  170.         }
  171.         public function GetSpecialFeed(feed:String, startIndex:Number, numAssets:Number):void
  172.         {
  173.             var queryString:String = mServerString + "/rest/assets/search/" + feed + "/" + startIndex + "/" + numAssets;
  174.             mLoader.load(new URLRequest(queryString));            
  175.         }
  176.         public function GotData(e:Event):void
  177.         {
  178.             var dataXML:XML = new XML(e.target.data);
  179.             
  180.             // Parse the XML
  181.             namespace atomenv = "http://www.w3.org/2005/Atom";
  182.             use namespace atomenv;
  183.             
  184.             var counter:Number = 0;
  185. //            trace(dataXML);
  186.             for each (var asset:XML in dataXML..asset)
  187.             {
  188.                 var id:String = asset..id.toString();
  189.                 GetSmallPNG(id);
  190.                 counter++;
  191.                 if(counter == mCount)
  192.                 {
  193.                     break;
  194.                 }
  195.             }
  196. //            mStatusText.text = "Loaded query: " + mCurrentQueryString;
  197.             
  198.         }        
  199.         
  200.         public function GetSmallPNG(assetId:String):void
  201.         {
  202.             var subId1:String = assetId.substr(0,3);
  203.             var subId2:String = assetId.substr(3,3);
  204.             var subId3:String = assetId.substr(6,3);
  205.             var smallPNGURL:String = "http://www.spore.com/static/thumb/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + ".png"
  206.             //var smallPNGURL:String = "http://www.spore.com/static/image/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + "_lrg.png"
  207.             
  208.             lane.addImg(smallPNGURL);
  209.         }
  210.     }
  211. }
  212.     
  213. import flash.display.Loader;
  214. import flash.display.LoaderInfo;
  215. import flash.display.Sprite
  216. import flash.events.MouseEvent;
  217. import caurina.transitions.Tweener;
  218. import flash.net.URLRequest;
  219. import flash.events.Event;
  220. import flash.system.LoaderContext;
  221. import flash.geom.Rectangle;
  222. import flash.filters.BlurFilter;
  223. class Lane
  224. extends Sprite 
  225. {
  226.     private var imgContainer:Sprite = new Sprite();
  227.     public var laneWidth:Number = 465;
  228.     public var laneHeight:Number = 465;
  229.     
  230.     
  231.     public function Lane():void 
  232.     {        
  233.         addEventListener(Event.ADDED_TO_STAGE, init);
  234.     }
  235.     private function init(e:Event):void 
  236.     {
  237.         removeEventListener(Event.ADDED_TO_STAGE, init);
  238.         addChild(imgContainer);        
  239.         stage.addEventListener(Event.ENTER_FRAME, setBlurs);
  240.     }
  241.     public function addImg(url:String):void 
  242.     {
  243.         var cell:ImgCell = new ImgCell(url);
  244.         cell.x = Math.random() * laneWidth;
  245.         imgContainer.addChild(cell);
  246.         cell.addEventListener("loaded", cellLoadCompleteHandler, false0true);
  247.         setDepth(cell);
  248.     }
  249.     private function cellLoadCompleteHandler(e:Event):void 
  250.     {
  251.         var cell:ImgCell = e.target as ImgCell;
  252.         cell.removeEventListener("loaded", cellLoadCompleteHandler);
  253.         cell.addEventListener("appeared", cellAppearCompleteHandler, false0true);
  254.     }
  255.     private function setDepth(cell:ImgCell):void 
  256.     {
  257.         var scale:Number = Math.random() + 0.01;
  258.         cell.scaleX = cell.scaleY = scale * 1.4 + 0.2;
  259.         cell.y =  laneHeight * scale;
  260.         sortDepth();
  261.     }
  262.     private function sortDepth():void 
  263.     {
  264.         var num:uint = imgContainer.numChildren;
  265.         var cells:Array = new Array();
  266.         while (num--) cells.unshift(imgContainer.getChildAt(num));
  267.         cells.sortOn("y"Array.NUMERIC);    
  268.         num = cells.length;
  269.         while (num--) imgContainer.setChildIndex(cells[num], 0);
  270.     }
  271.     private function cellAppearCompleteHandler(e:Event):void 
  272.     {
  273.         var cell:ImgCell = e.target as ImgCell;
  274.         cell.removeEventListener("appeared", cellLoadCompleteHandler);
  275.         cell.addEventListener("out", cellOutHandler);
  276.     }
  277.     private function cellOutHandler(e:Event):void 
  278.     {
  279.         var cell:ImgCell = e.target as ImgCell;
  280.         cell.x = laneWidth + cell.width;
  281.         setDepth(cell);
  282.     }
  283.     private function setBlurs(e:Event):void 
  284.     {
  285.         var num:uint = imgContainer.numChildren;
  286.         while (num--) {
  287.             var cell:ImgCell = imgContainer.getChildAt(num) as ImgCell;
  288.             var mx:Number = Math.abs(cell.mouseX) / cell.width;
  289.             var my:Number = Math.abs(cell.mouseY+cell.height/2) / cell.height;
  290.             
  291.             var r:Number = Math.sqrt(mx * mx + my * my);
  292.             if (r < 1) r *=r;
  293.             
  294.             var b:Number = Math.min(100 * cell.scaleX, r *  6 * cell.scaleX);
  295.             
  296.             cell.filters = 
  297.             [
  298.                 new BlurFilter(b,b,1)
  299.             ];
  300.         }
  301.     }
  302. }
  303. import flash.display.BitmapData
  304. import flash.display.Bitmap;
  305. import flash.filters.DropShadowFilter;
  306. import flash.filters.GlowFilter;
  307. class Film
  308. extends Sprite
  309. {
  310.     public var moveX:Number;
  311.     public var moveY:Number;
  312.     public function Film(bd:BitmapData):void 
  313.     {
  314.         var bmp:Bitmap = new Bitmap(bd);
  315.         graphics.beginFill(0xFFFFFF);
  316.         graphics.drawRect( -70, -70140140);
  317.         bmp.x = -60;
  318.         bmp.y = -45;
  319.         rotation = Math.random()*30-15;
  320.         scaleX = scaleY = Math.random()*1+0.5;
  321.         addChild(bmp);
  322.         filters = [
  323.             new DropShadowFilter(width * 0.054500.30, width * 0.15, height * 0.15), 
  324.             new GlowFilter(0xCCCCCC, 1.0, width * 0.04, height * 0.04)
  325.         ];        
  326.         
  327.         moveX = Math.random() * 4 -2;
  328.         moveY = -(Math.random() * 4 + 5);
  329.     }
  330. }
  331. class ImgCell
  332. extends Sprite
  333. {
  334.     private var img:Loader;    
  335.     private var maskSp:Sprite = new Sprite();
  336.     private var hole:Sprite = new Sprite();
  337.     
  338.     public function ImgCell(url:String):void 
  339.     {
  340.         //loader
  341.         img = new Loader();
  342.         img.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
  343.         img.load(new URLRequest(url));
  344.     }
  345.     private function loadCompleteHandler(e:Event):void 
  346.     {
  347.         img.x = -img.width / 2
  348.         maskSp.graphics.beginFill(0);
  349.         maskSp.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  350.         maskSp.graphics.drawRect(-img.width/2, -img.height, img.width, img.height);
  351.         
  352.         hole.graphics.beginFill(0x110909);
  353.         hole.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  354.         hole.y = maskSp.y = 0//-hole.height/2;
  355.         
  356.         img.mask = maskSp;
  357.         
  358.         addChild(hole);
  359.         addChild(img);
  360.         addChild(maskSp);
  361.         //
  362.         visible = true;
  363.         dispatchEvent(new Event("loaded"));
  364.         
  365.         hole.scaleX = hole.scaleY = 0.1;
  366.         Tweener.addTween(hole, {
  367.             scaleX: 1,
  368.             scaleY: 1,
  369.             time: 0.5,
  370.             transition: "easeOutQuint"
  371.         });
  372.         
  373.         img.y = img.height*0.5;
  374.         Tweener.addTween(img, {
  375.             y: -img.height,
  376.             time: 0.2 + Math.random() * 0.5,
  377.             delay:0.1,
  378.             transition: "easeOutCubic",
  379.             onComplete: appearCompleteHandler
  380.         });
  381.     }
  382.     private function appearCompleteHandler():void 
  383.     {
  384.         Tweener.addTween(hole, {
  385.             scaleX: 0.1,
  386.             scaleY: 0.1,
  387.             time: 0.2,
  388.             transition: "easeInQuint",
  389.             onComplete: holeCompleteHandler
  390.         });
  391.     }
  392.     private function holeCompleteHandler():void 
  393.     {
  394.         removeChild(hole);
  395.         removeChild(maskSp);
  396.         img.mask = null;
  397.         hole = maskSp = null;
  398.         dispatchEvent(new Event("appeared"));
  399.         
  400.         addEventListener(Event.ENTER_FRAME, enterFrameHandler, false0true);
  401.     }
  402.     private function enterFrameHandler(e:Event):void 
  403.     {
  404.         x -= width * 0.01;// (Math.random() * 1 + 1) * 0.01;
  405.         if (x + width / 2 < 0) dispatchEvent(new Event("out"));
  406.     }
  407. }
noswf
  1. // forked from miyaoka's SporeLaneCameraSnap
  2. package 
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.events.Event;
  6.     import flash.geom.Matrix;
  7.     import flash.net.URLLoader;
  8.     import flash.net.URLRequest;
  9.     import flash.events.MouseEvent;
  10.     import flash.filters.GlowFilter;
  11.     import flash.ui.Mouse;
  12.     import caurina.transitions.Tweener;
  13.     import flash.display.GradientType;
  14.     import flash.media.Sound;
  15.     import flash.display.BitmapData;
  16.     import flash.display.Bitmap;
  17.     import flash.filters.DropShadowFilter;
  18.     import flash.system.Security;
  19.     [SWF(width="465", height="120", backgroundColor= 0x000000, frameRate="60")]
  20.     public class SporeLane
  21.     extends Sprite
  22.     {
  23.         // our search types:
  24.         public var mQueries:Array = new Array("FEATURED""RANDOM""TOP_RATED""TOP_RATED_NEW""NEWEST""CUTE_AND_CREEPY""MAXIS_MADE");
  25.         // a loader for the query
  26.         public var mLoader:URLLoader;
  27.         
  28.         public var mServerString:String = "http://www.spore.com";
  29.         public var mCurrentQueryString:String = "";
  30.         public var mCurrentQuery:Number = Math.floor(Math.random()*mQueries.length);
  31.         public var mStartIndex:Number = 0;
  32.         public var mCount:Number = 50;
  33.         
  34.         private var lane:Lane;
  35.         private var focus:Sprite;
  36.         private var shutter:Sprite;
  37.         private var bg:Sprite;
  38. /*
  39. camera sound by SFX Bible on soundSnap
  40. http://www.soundsnap.com/node/41248
  41. */
  42.         private var shutterSndURL:String = "http://www.t-p.jp/flash/FOLEY CAMERA TAKE PICTURE 01.mp3";
  43.         private var shutterSnd:Sound;
  44.         
  45.         public function SporeLane():void 
  46.         {
  47.             Security.loadPolicyFile("http://www.t-p.jp/crossdomain.xml");
  48.             //lane
  49.             lane= new Lane();
  50.             lane.laneHeight = 550;
  51.             lane.y = -20;
  52.             //focus
  53.             focus = new Sprite();
  54.             var fx:Number = 48;
  55.             var fy:Number = 36;
  56.             var fr:Number = 6;
  57.             focus.graphics.lineStyle(1.5,0,0.5);
  58.             focus.graphics.moveTo(-fx-fr, -fy);
  59.             focus.graphics.curveTo(-fx-fr, -fy-fr, -fx, -fy-fr);
  60.             focus.graphics.moveTo(fx+fr, -fy);
  61.             focus.graphics.curveTo(fx+fr, -fy-fr, fx, -fy-fr);
  62.             focus.graphics.moveTo(-fx-fr, fy);
  63.             focus.graphics.curveTo(-fx-fr, fy+fr, -fx, fy+fr);
  64.             focus.graphics.moveTo(fx+fr, fy);
  65.             focus.graphics.curveTo(fx + fr, fy + fr, fx, fy + fr);
  66.             focus.graphics.moveTo(-fr, 0);
  67.             focus.graphics.lineTo(fr, 0);
  68.             focus.graphics.moveTo(0, -fr);
  69.             focus.graphics.lineTo(0, fr);
  70.             focus.filters = [
  71.                 new GlowFilter(0xFFFFFF, 0.7,2,2,6)
  72.             ];
  73.             Mouse.hide();
  74.             
  75.             //shutter
  76.             shutter = new Sprite();
  77.             shutter.graphics.beginFill(0);
  78.             shutter.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  79.             shutter.visible = false;
  80.             
  81.             shutterSnd = new Sound(new URLRequest(shutterSndURL));
  82.             //bg
  83.             bg = new Sprite();
  84.             var mtr:Matrix = new Matrix();
  85.             mtr.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI/2);
  86.             bg.graphics.beginGradientFill(
  87.                 GradientType.LINEAR, 
  88.                 [0xEEEEEE, 0xDDDDCC], 
  89.                 [1,1],
  90.                 [0255],
  91.                 mtr
  92.             );
  93.             bg.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  94.             
  95.             //add
  96.             addChild(bg);
  97.             addChild(lane);
  98.             addChild(focus);
  99.             addChild(shutter);
  100.             stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
  101.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  102.             
  103.             //PreLoad mochi
  104.             //achaSpore
  105.             lane.addImg("http://www.t-p.jp/flash/achaSpore128.ng");
  106.             //achamo
  107.             lane.addImg("http://www.t-p.jp/flash/Achamo128.ng");
  108.             //mochi
  109.             lane.addImg("http://www.t-p.jp/flash/mochi128.ng");
  110.             
  111.             // initiate the query
  112.             mLoader = new URLLoader();
  113.             mLoader.addEventListener(Event.COMPLETE, GotData);
  114.             GetSpecialFeed(mQueries[mCurrentQuery], mStartIndex, mCount); 
  115.         }
  116.         private function mouseMoveHandler(e:MouseEvent):void 
  117.         {
  118.             focus.x = mouseX;
  119.             focus.y = mouseY;
  120.         }
  121.         private function mouseDownHandler(e:MouseEvent):void 
  122.         {
  123.             //film
  124.             var bd:BitmapData = new BitmapData(120,90);
  125.             bd.draw(bg, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  126.             bd.draw(lane, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  127.             
  128.             var film:Film = new Film(bd);
  129.             film.addEventListener(Event.ENTER_FRAME, filmThrow,false,0,true);
  130.             film.x = mouseX;
  131.             film.y = mouseY;
  132.             addChild(film);
  133.             
  134.             //shutter
  135.             shutter.y = -shutter.height;
  136.             shutter.visible = true;
  137.             setChildIndex(shutter, numChildren - 1);
  138.             
  139.             shutterSnd.play();
  140.             Tweener.addTween(shutter, {
  141.                 y:0,
  142.                 time:0.03,
  143.                 transition: "linear",
  144.                 onComplete: function():void {
  145.                     Tweener.addTween(shutter, {
  146.                         y:-shutter.height,
  147.                         time:0.03,
  148.                         transition: "linear",
  149.                         onComplete: function():void {
  150.                             shutter.visible = false
  151.                         }
  152.                     });
  153.                 }
  154.             });
  155.             
  156.         }
  157.         private function filmThrow(e:Event):void 
  158.         {
  159.             var film:Film = e.target as Film;
  160.             film.x += film.moveX;
  161.             film.y += film.moveY;
  162.             
  163.             film.moveY += 0.2;
  164.             if (film.y - film.height > stage.stageHeight) 
  165.             {
  166.                 removeChild(film);
  167.                 film.removeEventListener(Event.ENTER_FRAME, filmThrow);
  168.                 film = null;
  169.             }
  170.         }
  171.         public function GetSpecialFeed(feed:String, startIndex:Number, numAssets:Number):void
  172.         {
  173.             var queryString:String = mServerString + "/rest/assets/search/" + feed + "/" + startIndex + "/" + numAssets;
  174.             mLoader.load(new URLRequest(queryString));            
  175.         }
  176.         public function GotData(e:Event):void
  177.         {
  178.             var dataXML:XML = new XML(e.target.data);
  179.             
  180.             // Parse the XML
  181.             namespace atomenv = "http://www.w3.org/2005/Atom";
  182.             use namespace atomenv;
  183.             
  184.             var counter:Number = 0;
  185. //            trace(dataXML);
  186.             for each (var asset:XML in dataXML..asset)
  187.             {
  188.                 var id:String = asset..id.toString();
  189.                 GetSmallPNG(id);
  190.                 counter++;
  191.                 if(counter == mCount)
  192.                 {
  193.                     break;
  194.                 }
  195.             }
  196. //            mStatusText.text = "Loaded query: " + mCurrentQueryString;
  197.             
  198.         }        
  199.         
  200.         public function GetSmallPNG(assetId:String):void
  201.         {
  202.             var subId1:String = assetId.substr(0,3);
  203.             var subId2:String = assetId.substr(3,3);
  204.             var subId3:String = assetId.substr(6,3);
  205.             var smallPNGURL:String = "http://www.spore.com/static/thumb/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + ".png"
  206.             //var smallPNGURL:String = "http://www.spore.com/static/image/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + "_lrg.png"
  207.             
  208.             lane.addImg(smallPNGURL);
  209.         }
  210.     }
  211. }
  212.     
  213. import flash.display.Loader;
  214. import flash.display.LoaderInfo;
  215. import flash.display.Sprite
  216. import flash.events.MouseEvent;
  217. import caurina.transitions.Tweener;
  218. import flash.net.URLRequest;
  219. import flash.events.Event;
  220. import flash.system.LoaderContext;
  221. import flash.geom.Rectangle;
  222. import flash.filters.BlurFilter;
  223. class Lane
  224. extends Sprite 
  225. {
  226.     private var imgContainer:Sprite = new Sprite();
  227.     public var laneWidth:Number = 465;
  228.     public var laneHeight:Number = 465;
  229.     
  230.     
  231.     public function Lane():void 
  232.     {        
  233.         addEventListener(Event.ADDED_TO_STAGE, init);
  234.     }
  235.     private function init(e:Event):void 
  236.     {
  237.         removeEventListener(Event.ADDED_TO_STAGE, init);
  238.         addChild(imgContainer);        
  239.         stage.addEventListener(Event.ENTER_FRAME, setBlurs);
  240.     }
  241.     public function addImg(url:String):void 
  242.     {
  243.         var cell:ImgCell = new ImgCell(url);
  244.         cell.x = Math.random() * laneWidth;
  245.         imgContainer.addChild(cell);
  246.         cell.addEventListener("loaded", cellLoadCompleteHandler, false0true);
  247.         setDepth(cell);
  248.     }
  249.     private function cellLoadCompleteHandler(e:Event):void 
  250.     {
  251.         var cell:ImgCell = e.target as ImgCell;
  252.         cell.removeEventListener("loaded", cellLoadCompleteHandler);
  253.         cell.addEventListener("appeared", cellAppearCompleteHandler, false0true);
  254.     }
  255.     private function setDepth(cell:ImgCell):void 
  256.     {
  257.         var scale:Number = Math.random() + 0.01;
  258.         cell.scaleX = cell.scaleY = scale * 1.4 + 0.2;
  259.         cell.y =  laneHeight * scale;
  260.         sortDepth();
  261.     }
  262.     private function sortDepth():void 
  263.     {
  264.         var num:uint = imgContainer.numChildren;
  265.         var cells:Array = new Array();
  266.         while (num--) cells.unshift(imgContainer.getChildAt(num));
  267.         cells.sortOn("y"Array.NUMERIC);    
  268.         num = cells.length;
  269.         while (num--) imgContainer.setChildIndex(cells[num], 0);
  270.     }
  271.     private function cellAppearCompleteHandler(e:Event):void 
  272.     {
  273.         var cell:ImgCell = e.target as ImgCell;
  274.         cell.removeEventListener("appeared", cellLoadCompleteHandler);
  275.         cell.addEventListener("out", cellOutHandler);
  276.     }
  277.     private function cellOutHandler(e:Event):void 
  278.     {
  279.         var cell:ImgCell = e.target as ImgCell;
  280.         cell.x = laneWidth + cell.width;
  281.         setDepth(cell);
  282.     }
  283.     private function setBlurs(e:Event):void 
  284.     {
  285.         var num:uint = imgContainer.numChildren;
  286.         while (num--) {
  287.             var cell:ImgCell = imgContainer.getChildAt(num) as ImgCell;
  288.             var mx:Number = Math.abs(cell.mouseX) / cell.width;
  289.             var my:Number = Math.abs(cell.mouseY+cell.height/2) / cell.height;
  290.             
  291.             var r:Number = Math.sqrt(mx * mx + my * my);
  292.             if (r < 1) r *=r;
  293.             
  294.             var b:Number = Math.min(100 * cell.scaleX, r *  6 * cell.scaleX);
  295.             
  296.             cell.filters = 
  297.             [
  298.                 new BlurFilter(b,b,1)
  299.             ];
  300.         }
  301.     }
  302. }
  303. import flash.display.BitmapData
  304. import flash.display.Bitmap;
  305. import flash.filters.DropShadowFilter;
  306. import flash.filters.GlowFilter;
  307. class Film
  308. extends Sprite
  309. {
  310.     public var moveX:Number;
  311.     public var moveY:Number;
  312.     public function Film(bd:BitmapData):void 
  313.     {
  314.         var bmp:Bitmap = new Bitmap(bd);
  315.         graphics.beginFill(0xFFFFFF);
  316.         graphics.drawRect( -70, -70140140);
  317.         bmp.x = -60;
  318.         bmp.y = -45;
  319.         rotation = Math.random()*30-15;
  320.         scaleX = scaleY = Math.random()*1+0.5;
  321.         addChild(bmp);
  322.         filters = [
  323.             new DropShadowFilter(width * 0.054500.30, width * 0.15, height * 0.15), 
  324.             new GlowFilter(0xCCCCCC, 1.0, width * 0.04, height * 0.04)
  325.         ];        
  326.         
  327.         moveX = Math.random() * 4 -2;
  328.         moveY = -(Math.random() * 4 + 5);
  329.     }
  330. }
  331. class ImgCell
  332. extends Sprite
  333. {
  334.     private var img:Loader;    
  335.     private var maskSp:Sprite = new Sprite();
  336.     private var hole:Sprite = new Sprite();
  337.     
  338.     public function ImgCell(url:String):void 
  339.     {
  340.         //loader
  341.         img = new Loader();
  342.         img.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
  343.         img.load(new URLRequest(url));
  344.     }
  345.     private function loadCompleteHandler(e:Event):void 
  346.     {
  347.         img.x = -img.width / 2
  348.         maskSp.graphics.beginFill(0);
  349.         maskSp.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  350.         maskSp.graphics.drawRect(-img.width/2, -img.height, img.width, img.height);
  351.         
  352.         hole.graphics.beginFill(0x110909);
  353.         hole.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  354.         hole.y = maskSp.y = 0//-hole.height/2;
  355.         
  356.         img.mask = maskSp;
  357.         
  358.         addChild(hole);
  359.         addChild(img);
  360.         addChild(maskSp);
  361.         //
  362.         visible = true;
  363.         dispatchEvent(new Event("loaded"));
  364.         
  365.         hole.scaleX = hole.scaleY = 0.1;
  366.         Tweener.addTween(hole, {
  367.             scaleX: 1,
  368.             scaleY: 1,
  369.             time: 0.5,
  370.             transition: "easeOutQuint"
  371.         });
  372.         
  373.         img.y = img.height*0.5;
  374.         Tweener.addTween(img, {
  375.             y: -img.height,
  376.             time: 0.2 + Math.random() * 0.5,
  377.             delay:0.1,
  378.             transition: "easeOutCubic",
  379.             onComplete: appearCompleteHandler
  380.         });
  381.     }
  382.     private function appearCompleteHandler():void 
  383.     {
  384.         Tweener.addTween(hole, {
  385.             scaleX: 0.1,
  386.             scaleY: 0.1,
  387.             time: 0.2,
  388.             transition: "easeInQuint",
  389.             onComplete: holeCompleteHandler
  390.         });
  391.     }
  392.     private function holeCompleteHandler():void 
  393.     {
  394.         removeChild(hole);
  395.         removeChild(maskSp);
  396.         img.mask = null;
  397.         hole = maskSp = null;
  398.         dispatchEvent(new Event("appeared"));
  399.         
  400.         addEventListener(Event.ENTER_FRAME, enterFrameHandler, false0true);
  401.     }
  402.     private function enterFrameHandler(e:Event):void 
  403.     {
  404.         x -= width * 0.01;// (Math.random() * 1 + 1) * 0.01;
  405.         if (x + width / 2 < 0) dispatchEvent(new Event("out"));
  406.     }
  407. }
noswf
  1. // forked from miyaoka's SporeLaneCameraSnap
  2. package 
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.events.Event;
  6.     import flash.geom.Matrix;
  7.     import flash.net.URLLoader;
  8.     import flash.net.URLRequest;
  9.     import flash.events.MouseEvent;
  10.     import flash.filters.GlowFilter;
  11.     import flash.ui.Mouse;
  12.     import caurina.transitions.Tweener;
  13.     import flash.display.GradientType;
  14.     import flash.media.Sound;
  15.     import flash.display.BitmapData;
  16.     import flash.display.Bitmap;
  17.     import flash.filters.DropShadowFilter;
  18.     import flash.system.Security;
  19.     [SWF(width="465", height="465", backgroundColor= 0xffffff, frameRate="60")]
  20.     public class SporeLane
  21.     extends Sprite
  22.     {
  23.         // our search types:
  24.         public var mQueries:Array = new Array("FEATURED""RANDOM""TOP_RATED""TOP_RATED_NEW""NEWEST""CUTE_AND_CREEPY""MAXIS_MADE");
  25.         // a loader for the query
  26.         public var mLoader:URLLoader;
  27.         
  28.         public var mServerString:String = "http://www.spore.com";
  29.         public var mCurrentQueryString:String = "";
  30.         public var mCurrentQuery:Number = Math.floor(Math.random()*mQueries.length);
  31.         public var mStartIndex:Number = 0;
  32.         public var mCount:Number = 50;
  33.         
  34.         private var lane:Lane;
  35.         private var focus:Sprite;
  36.         private var shutter:Sprite;
  37.         private var bg:Sprite;
  38. /*
  39. camera sound by SFX Bible on soundSnap
  40. http://www.soundsnap.com/node/41248
  41. */
  42.         private var shutterSndURL:String = "http://www.t-p.jp/flash/FOLEY CAMERA TAKE PICTURE 01.mp3";
  43.         private var shutterSnd:Sound;
  44.         
  45.         public function SporeLane():void 
  46.         {
  47.             Security.loadPolicyFile("http://www.t-p.jp/crossdomain.xml");
  48.             //lane
  49.             lane= new Lane();
  50.             lane.laneHeight = 550;
  51.             lane.y = -20;
  52.             //focus
  53.             focus = new Sprite();
  54.             var fx:Number = 48;
  55.             var fy:Number = 36;
  56.             var fr:Number = 6;
  57.             focus.graphics.lineStyle(1.5,0,0.5);
  58.             focus.graphics.moveTo(-fx-fr, -fy);
  59.             focus.graphics.curveTo(-fx-fr, -fy-fr, -fx, -fy-fr);
  60.             focus.graphics.moveTo(fx+fr, -fy);
  61.             focus.graphics.curveTo(fx+fr, -fy-fr, fx, -fy-fr);
  62.             focus.graphics.moveTo(-fx-fr, fy);
  63.             focus.graphics.curveTo(-fx-fr, fy+fr, -fx, fy+fr);
  64.             focus.graphics.moveTo(fx+fr, fy);
  65.             focus.graphics.curveTo(fx + fr, fy + fr, fx, fy + fr);
  66.             focus.graphics.moveTo(-fr, 0);
  67.             focus.graphics.lineTo(fr, 0);
  68.             focus.graphics.moveTo(0, -fr);
  69.             focus.graphics.lineTo(0, fr);
  70.             focus.filters = [
  71.                 new GlowFilter(0xFFFFFF, 0.7,2,2,6)
  72.             ];
  73.             Mouse.hide();
  74.             
  75.             //shutter
  76.             shutter = new Sprite();
  77.             shutter.graphics.beginFill(0);
  78.             shutter.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  79.             shutter.visible = false;
  80.             
  81.             shutterSnd = new Sound(new URLRequest(shutterSndURL));
  82.             //bg
  83.             bg = new Sprite();
  84.             var mtr:Matrix = new Matrix();
  85.             mtr.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI/2);
  86.             bg.graphics.beginGradientFill(
  87.                 GradientType.LINEAR, 
  88.                 [0xEEEEEE, 0xDDDDCC], 
  89.                 [1,1],
  90.                 [0255],
  91.                 mtr
  92.             );
  93.             bg.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  94.             
  95.             //add
  96.             addChild(bg);
  97.             addChild(lane);
  98.             addChild(focus);
  99.             addChild(shutter);
  100.             stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
  101.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  102.             
  103.             //PreLoad mochi
  104.             //achaSpore
  105.             lane.addImg("http://www.t-p.jp/flash/achaSpore128.png");
  106.             //achamo
  107.             lane.addImg("http://www.t-p.jp/flash/Achamo128.png");
  108.             //mochi
  109.             lane.addImg("http://www.t-p.jp/flash/mochi128.png");
  110.             
  111.             // initiate the query
  112.             mLoader = new URLLoader();
  113.             mLoader.addEventListener(Event.COMPLETE, GotData);
  114.             GetSpecialFeed(mQueries[mCurrentQuery], mStartIndex, mCount); 
  115.         }
  116.         private function mouseMoveHandler(e:MouseEvent):void 
  117.         {
  118.             focus.x = mouseX;
  119.             focus.y = mouseY;
  120.         }
  121.         private function mouseDownHandler(e:MouseEvent):void 
  122.         {
  123.             //film
  124.             var bd:BitmapData = new BitmapData(120,90);
  125.             bd.draw(bg, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  126.             bd.draw(lane, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  127.             
  128.             var film:Film = new Film(bd);
  129.             film.addEventListener(Event.ENTER_FRAME, filmThrow,false,0,true);
  130.             film.x = mouseX;
  131.             film.y = mouseY;
  132.             addChild(film);
  133.             
  134.             //shutter
  135.             shutter.y = -shutter.height;
  136.             shutter.visible = true;
  137.             setChildIndex(shutter, numChildren - 1);
  138.             
  139.             shutterSnd.play();
  140.             Tweener.addTween(shutter, {
  141.                 y:0,
  142.                 time:0.03,
  143.                 transition: "linear",
  144.                 onComplete: function():void {
  145.                     Tweener.addTween(shutter, {
  146.                         y:-shutter.height,
  147.                         time:0.03,
  148.                         transition: "linear",
  149.                         onComplete: function():void {
  150.                             shutter.visible = false
  151.                         }
  152.                     });
  153.                 }
  154.             });
  155.             
  156.         }
  157.         private function filmThrow(e:Event):void 
  158.         {
  159.             var film:Film = e.target as Film;
  160.             film.x += film.moveX;
  161.             film.y += film.moveY;
  162.             
  163.             film.moveY += 0.2;
  164.             if (film.y - film.height > stage.stageHeight) 
  165.             {
  166.                 removeChild(film);
  167.                 film.removeEventListener(Event.ENTER_FRAME, filmThrow);
  168.                 film = null;
  169.             }
  170.         }
  171.         public function GetSpecialFeed(feed:String, startIndex:Number, numAssets:Number):void
  172.         {
  173.             var queryString:String = mServerString + "/rest/assets/search/" + feed + "/" + startIndex + "/" + numAssets;
  174.             mLoader.load(new URLRequest(queryString));            
  175.         }
  176.         public function GotData(e:Event):void
  177.         {
  178.             var dataXML:XML = new XML(e.target.data);
  179.             
  180.             // Parse the XML
  181.             namespace atomenv = "http://www.w3.org/2005/Atom";
  182.             use namespace atomenv;
  183.             
  184.             var counter:Number = 0;
  185. //            trace(dataXML);
  186.             for each (var asset:XML in dataXML..asset)
  187.             {
  188.                 var id:String = asset..id.toString();
  189.                 GetSmallPNG(id);
  190.                 counter++;
  191.                 if(counter == mCount)
  192.                 {
  193.                     break;
  194.                 }
  195.             }
  196. //            mStatusText.text = "Loaded query: " + mCurrentQueryString;
  197.             
  198.         }        
  199.         
  200.         public function GetSmallPNG(assetId:String):void
  201.         {
  202.             var subId1:String = assetId.substr(0,3);
  203.             var subId2:String = assetId.substr(3,3);
  204.             var subId3:String = assetId.substr(6,3);
  205.             var smallPNGURL:String = "http://www.spore.com/static/thumb/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + ".png"
  206.             //var smallPNGURL:String = "http://www.spore.com/static/image/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + "_lrg.png"
  207.             
  208.             lane.addImg(smallPNGURL);
  209.         }
  210.     }
  211. }
  212.     
  213. import flash.display.Loader;
  214. import flash.display.LoaderInfo;
  215. import flash.display.Sprite
  216. import flash.events.MouseEvent;
  217. import caurina.transitions.Tweener;
  218. import flash.net.URLRequest;
  219. import flash.events.Event;
  220. import flash.system.LoaderContext;
  221. import flash.geom.Rectangle;
  222. import flash.filters.BlurFilter;
  223. class Lane
  224. extends Sprite 
  225. {
  226.     private var imgContainer:Sprite = new Sprite();
  227.     public var laneWidth:Number = 465;
  228.     public var laneHeight:Number = 465;
  229.     
  230.     
  231.     public function Lane():void 
  232.     {        
  233.         addEventListener(Event.ADDED_TO_STAGE, init);
  234.     }
  235.     private function init(e:Event):void 
  236.     {
  237.         removeEventListener(Event.ADDED_TO_STAGE, init);
  238.         addChild(imgContainer);        
  239.         stage.addEventListener(Event.ENTER_FRAME, setBlurs);
  240.     }
  241.     public function addImg(url:String):void 
  242.     {
  243.         var cell:ImgCell = new ImgCell(url);
  244.         cell.x = Math.random() * laneWidth;
  245.         imgContainer.addChild(cell);
  246.         cell.addEventListener("loaded", cellLoadCompleteHandler, false0true);
  247.         setDepth(cell);
  248.     }
  249.     private function cellLoadCompleteHandler(e:Event):void 
  250.     {
  251.         var cell:ImgCell = e.target as ImgCell;
  252.         cell.removeEventListener("loaded", cellLoadCompleteHandler);
  253.         cell.addEventListener("appeared", cellAppearCompleteHandler, false0true);
  254.     }
  255.     private function setDepth(cell:ImgCell):void 
  256.     {
  257.         var scale:Number = Math.random() + 0.01;
  258.         cell.scaleX = cell.scaleY = scale * 1.4 + 0.2;
  259.         cell.y =  laneHeight * scale;
  260.         sortDepth();
  261.     }
  262.     private function sortDepth():void 
  263.     {
  264.         var num:uint = imgContainer.numChildren;
  265.         var cells:Array = new Array();
  266.         while (num--) cells.unshift(imgContainer.getChildAt(num));
  267.         cells.sortOn("y"Array.NUMERIC);    
  268.         num = cells.length;
  269.         while (num--) imgContainer.setChildIndex(cells[num], 0);
  270.     }
  271.     private function cellAppearCompleteHandler(e:Event):void 
  272.     {
  273.         var cell:ImgCell = e.target as ImgCell;
  274.         cell.removeEventListener("appeared", cellLoadCompleteHandler);
  275.         cell.addEventListener("out", cellOutHandler);
  276.     }
  277.     private function cellOutHandler(e:Event):void 
  278.     {
  279.         var cell:ImgCell = e.target as ImgCell;
  280.         cell.x = laneWidth + cell.width;
  281.         setDepth(cell);
  282.     }
  283.     private function setBlurs(e:Event):void 
  284.     {
  285.         var num:uint = imgContainer.numChildren;
  286.         while (num--) {
  287.             var cell:ImgCell = imgContainer.getChildAt(num) as ImgCell;
  288.             var mx:Number = Math.abs(cell.mouseX) / cell.width;
  289.             var my:Number = Math.abs(cell.mouseY+cell.height/2) / cell.height;
  290.             
  291.             var r:Number = Math.sqrt(mx * mx + my * my);
  292.             if (r < 1) r *=r;
  293.             
  294.             var b:Number = Math.min(100 * cell.scaleX, r *  6 * cell.scaleX);
  295.             
  296.             cell.filters = 
  297.             [
  298.                 new BlurFilter(b,b,1)
  299.             ];
  300.         }
  301.     }
  302. }
  303. import flash.display.BitmapData
  304. import flash.display.Bitmap;
  305. import flash.filters.DropShadowFilter;
  306. import flash.filters.GlowFilter;
  307. class Film
  308. extends Sprite
  309. {
  310.     public var moveX:Number;
  311.     public var moveY:Number;
  312.     public function Film(bd:BitmapData):void 
  313.     {
  314.         var bmp:Bitmap = new Bitmap(bd);
  315.         graphics.beginFill(0xFFFFFF);
  316.         graphics.drawRect( -70, -70140140);
  317.         bmp.x = -60;
  318.         bmp.y = -45;
  319.         rotation = Math.random()*30-15;
  320.         scaleX = scaleY = Math.random()*1+0.5;
  321.         addChild(bmp);
  322.         filters = [
  323.             new DropShadowFilter(width * 0.054500.30, width * 0.15, height * 0.15), 
  324.             new GlowFilter(0xCCCCCC, 1.0, width * 0.04, height * 0.04)
  325.         ];        
  326.         
  327.         moveX = Math.random() * 4 -2;
  328.         moveY = -(Math.random() * 4 + 5);
  329.     }
  330. }
  331. class ImgCell
  332. extends Sprite
  333. {
  334.     private var img:Loader;    
  335.     private var maskSp:Sprite = new Sprite();
  336.     private var hole:Sprite = new Sprite();
  337.     
  338.     public function ImgCell(url:String):void 
  339.     {
  340.         //loader
  341.         img = new Loader();
  342.         img.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
  343.         img.load(new URLRequest(url));
  344.     }
  345.     private function loadCompleteHandler(e:Event):void 
  346.     {
  347.         img.x = -img.width / 2
  348.         maskSp.graphics.beginFill(0);
  349.         maskSp.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  350.         maskSp.graphics.drawRect(-img.width/2, -img.height, img.width, img.height);
  351.         
  352.         hole.graphics.beginFill(0x110909);
  353.         hole.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  354.         hole.y = maskSp.y = 0//-hole.height/2;
  355.         
  356.         img.mask = maskSp;
  357.         
  358.         addChild(hole);
  359.         addChild(img);
  360.         addChild(maskSp);
  361.         //
  362.         visible = true;
  363.         dispatchEvent(new Event("loaded"));
  364.         
  365.         hole.scaleX = hole.scaleY = 0.1;
  366.         Tweener.addTween(hole, {
  367.             scaleX: 1,
  368.             scaleY: 1,
  369.             time: 0.5,
  370.             transition: "easeOutQuint"
  371.         });
  372.         
  373.         img.y = img.height*0.5;
  374.         Tweener.addTween(img, {
  375.             y: -img.height,
  376.             time: 0.2 + Math.random() * 0.5,
  377.             delay:0.1,
  378.             transition: "easeOutCubic",
  379.             onComplete: appearCompleteHandler
  380.         });
  381.     }
  382.     private function appearCompleteHandler():void 
  383.     {
  384.         Tweener.addTween(hole, {
  385.             scaleX: 0.1,
  386.             scaleY: 0.1,
  387.             time: 0.2,
  388.             transition: "easeInQuint",
  389.             onComplete: holeCompleteHandler
  390.         });
  391.     }
  392.     private function holeCompleteHandler():void 
  393.     {
  394.         removeChild(hole);
  395.         removeChild(maskSp);
  396.         img.mask = null;
  397.         hole = maskSp = null;
  398.         dispatchEvent(new Event("appeared"));
  399.         
  400.         addEventListener(Event.ENTER_FRAME, enterFrameHandler, false0true);
  401.     }
  402.     private function enterFrameHandler(e:Event):void 
  403.     {
  404.         x -= width * 0.01;// (Math.random() * 1 + 1) * 0.01;
  405.         if (x + width / 2 < 0) dispatchEvent(new Event("out"));
  406.     }
  407. }
noswf
  1. // forked from miyaoka's SporeLaneCameraSnap
  2. package 
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.events.Event;
  6.     import flash.geom.Matrix;
  7.     import flash.net.URLLoader;
  8.     import flash.net.URLRequest;
  9.     import flash.events.MouseEvent;
  10.     import flash.filters.GlowFilter;
  11.     import flash.ui.Mouse;
  12.     import caurina.transitions.Tweener;
  13.     import flash.display.GradientType;
  14.     import flash.media.Sound;
  15.     import flash.display.BitmapData;
  16.     import flash.display.Bitmap;
  17.     import flash.filters.DropShadowFilter;
  18.     import flash.system.Security;
  19.     [SWF(width="465", height="465", backgroundColor= 0xffffff, frameRate="60")]
  20.     public class SporeLane
  21.     extends Sprite
  22.     {
  23.         // our search types:
  24.         public var mQueries:Array = new Array("FEATURED""RANDOM""TOP_RATED""TOP_RATED_NEW""NEWEST""CUTE_AND_CREEPY""MAXIS_MADE");
  25.         // a loader for the query
  26.         public var mLoader:URLLoader;
  27.         
  28.         public var mServerString:String = "http://www.spore.com";
  29.         public var mCurrentQueryString:String = "";
  30.         public var mCurrentQuery:Number = Math.floor(Math.random()*mQueries.length);
  31.         public var mStartIndex:Number = 0;
  32.         public var mCount:Number = 50;
  33.         
  34.         private var lane:Lane;
  35.         private var focus:Sprite;
  36.         private var shutter:Sprite;
  37.         private var bg:Sprite;
  38. /*
  39. camera sound by SFX Bible on soundSnap
  40. http://www.soundsnap.com/node/41248
  41. */
  42.         private var shutterSndURL:String = "http://www.t-p.jp/flash/FOLEY CAMERA TAKE PICTURE 01.mp3";
  43.         private var shutterSnd:Sound;
  44.         
  45.         public function SporeLane():void 
  46.         {
  47.             Security.loadPolicyFile("http://www.t-p.jp/crossdomain.xml");
  48.             //lane
  49.             lane= new Lane();
  50.             lane.laneHeight = 550;
  51.             lane.y = -20;
  52.             //focus
  53.             focus = new Sprite();
  54.             var fx:Number = 100;
  55.             var fy:Number = 100;
  56.             var fr:Number = 6;
  57.             focus.graphics.lineStyle(1.5,0,0.5);
  58.             focus.graphics.moveTo(-fx-fr, -fy);
  59.             focus.graphics.curveTo(-fx-fr, -fy-fr, -fx, -fy-fr);
  60.             focus.graphics.moveTo(fx+fr, -fy);
  61.             focus.graphics.curveTo(fx+fr, -fy-fr, fx, -fy-fr);
  62.             focus.graphics.moveTo(-fx-fr, fy);
  63.             focus.graphics.curveTo(-fx-fr, fy+fr, -fx, fy+fr);
  64.             focus.graphics.moveTo(fx+fr, fy);
  65.             focus.graphics.curveTo(fx + fr, fy + fr, fx, fy + fr);
  66.             focus.graphics.moveTo(-fr, 0);
  67.             focus.graphics.lineTo(fr, 0);
  68.             focus.graphics.moveTo(0, -fr);
  69.             focus.graphics.lineTo(0, fr);
  70.             focus.filters = [
  71.                 new GlowFilter(0xFFFFFF, 0.7,2,2,6)
  72.             ];
  73.             Mouse.hide();
  74.             
  75.             //shutter
  76.             shutter = new Sprite();
  77.             shutter.graphics.beginFill(0);
  78.             shutter.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  79.             shutter.visible = false;
  80.             
  81.             shutterSnd = new Sound(new URLRequest(shutterSndURL));
  82.             //bg
  83.             bg = new Sprite();
  84.             var mtr:Matrix = new Matrix();
  85.             mtr.createGradientBox(stage.stageWidth, stage.stageHeight, Math.PI/2);
  86.             bg.graphics.beginGradientFill(
  87.                 GradientType.LINEAR, 
  88.                 [0xEEEEEE, 0xDDDDCC], 
  89.                 [1,1],
  90.                 [0255],
  91.                 mtr
  92.             );
  93.             bg.graphics.drawRect(00, stage.stageWidth, stage.stageHeight);
  94.             
  95.             //add
  96.             addChild(bg);
  97.             addChild(lane);
  98.             addChild(focus);
  99.             addChild(shutter);
  100.             stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
  101.             stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  102.             
  103.             //PreLoad mochi
  104.             //achaSpore
  105.             lane.addImg("http://www.t-p.jp/flash/achaSpore128.png");
  106.             //achamo
  107.             lane.addImg("http://www.t-p.jp/flash/Achamo128.png");
  108.             //mochi
  109.             lane.addImg("http://www.t-p.jp/flash/mochi128.png");
  110.             
  111.             // initiate the query
  112.             mLoader = new URLLoader();
  113.             mLoader.addEventListener(Event.COMPLETE, GotData);
  114.             GetSpecialFeed(mQueries[mCurrentQuery], mStartIndex, mCount); 
  115.         }
  116.         private function mouseMoveHandler(e:MouseEvent):void 
  117.         {
  118.             focus.x = mouseX;
  119.             focus.y = mouseY;
  120.         }
  121.         private function mouseDownHandler(e:MouseEvent):void 
  122.         {
  123.             //film
  124.             var bd:BitmapData = new BitmapData(120,90);
  125.             bd.draw(bg, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  126.             bd.draw(lane, new Matrix(1001, -mouseX + 60, -mouseY + 45));
  127.             
  128.             var film:Film = new Film(bd);
  129.             film.addEventListener(Event.ENTER_FRAME, filmThrow,false,0,true);
  130.             film.x = mouseX;
  131.             film.y = mouseY;
  132.             addChild(film);
  133.             
  134.             //shutter
  135.             shutter.y = -shutter.height;
  136.             shutter.visible = true;
  137.             setChildIndex(shutter, numChildren - 1);
  138.             
  139.             shutterSnd.play();
  140.             Tweener.addTween(shutter, {
  141.                 y:0,
  142.                 time:0.03,
  143.                 transition: "linear",
  144.                 onComplete: function():void {
  145.                     Tweener.addTween(shutter, {
  146.                         y:-shutter.height,
  147.                         time:0.03,
  148.                         transition: "linear",
  149.                         onComplete: function():void {
  150.                             shutter.visible = false
  151.                         }
  152.                     });
  153.                 }
  154.             });
  155.             
  156.         }
  157.         private function filmThrow(e:Event):void 
  158.         {
  159.             var film:Film = e.target as Film;
  160.             film.x += film.moveX;
  161.             film.y += film.moveY;
  162.             
  163.             film.moveY += 0.2;
  164.             if (film.y - film.height > stage.stageHeight) 
  165.             {
  166.                 removeChild(film);
  167.                 film.removeEventListener(Event.ENTER_FRAME, filmThrow);
  168.                 film = null;
  169.             }
  170.         }
  171.         public function GetSpecialFeed(feed:String, startIndex:Number, numAssets:Number):void
  172.         {
  173.             var queryString:String = mServerString + "/rest/assets/search/" + feed + "/" + startIndex + "/" + numAssets;
  174.             mLoader.load(new URLRequest(queryString));            
  175.         }
  176.         public function GotData(e:Event):void
  177.         {
  178.             var dataXML:XML = new XML(e.target.data);
  179.             
  180.             // Parse the XML
  181.             namespace atomenv = "http://www.w3.org/2005/Atom";
  182.             use namespace atomenv;
  183.             
  184.             var counter:Number = 0;
  185. //            trace(dataXML);
  186.             for each (var asset:XML in dataXML..asset)
  187.             {
  188.                 var id:String = asset..id.toString();
  189.                 GetSmallPNG(id);
  190.                 counter++;
  191.                 if(counter == mCount)
  192.                 {
  193.                     break;
  194.                 }
  195.             }
  196. //            mStatusText.text = "Loaded query: " + mCurrentQueryString;
  197.             
  198.         }        
  199.         
  200.         public function GetSmallPNG(assetId:String):void
  201.         {
  202.             var subId1:String = assetId.substr(0,3);
  203.             var subId2:String = assetId.substr(3,3);
  204.             var subId3:String = assetId.substr(6,3);
  205.             var smallPNGURL:String = "http://www.spore.com/static/thumb/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + ".png"
  206.             //var smallPNGURL:String = "http://www.spore.com/static/image/" + subId1 + "/" + subId2 + "/" + subId3 + "/" + assetId + "_lrg.png"
  207.             
  208.             lane.addImg(smallPNGURL);
  209.         }
  210.     }
  211. }
  212.     
  213. import flash.display.Loader;
  214. import flash.display.LoaderInfo;
  215. import flash.display.Sprite
  216. import flash.events.MouseEvent;
  217. import caurina.transitions.Tweener;
  218. import flash.net.URLRequest;
  219. import flash.events.Event;
  220. import flash.system.LoaderContext;
  221. import flash.geom.Rectangle;
  222. import flash.filters.BlurFilter;
  223. class Lane
  224. extends Sprite 
  225. {
  226.     private var imgContainer:Sprite = new Sprite();
  227.     public var laneWidth:Number = 465;
  228.     public var laneHeight:Number = 465;
  229.     
  230.     
  231.     public function Lane():void 
  232.     {        
  233.         addEventListener(Event.ADDED_TO_STAGE, init);
  234.     }
  235.     private function init(e:Event):void 
  236.     {
  237.         removeEventListener(Event.ADDED_TO_STAGE, init);
  238.         addChild(imgContainer);        
  239.         stage.addEventListener(Event.ENTER_FRAME, setBlurs);
  240.     }
  241.     public function addImg(url:String):void 
  242.     {
  243.         var cell:ImgCell = new ImgCell(url);
  244.         cell.x = Math.random() * laneWidth;
  245.         imgContainer.addChild(cell);
  246.         cell.addEventListener("loaded", cellLoadCompleteHandler, false0true);
  247.         setDepth(cell);
  248.     }
  249.     private function cellLoadCompleteHandler(e:Event):void 
  250.     {
  251.         var cell:ImgCell = e.target as ImgCell;
  252.         cell.removeEventListener("loaded", cellLoadCompleteHandler);
  253.         cell.addEventListener("appeared", cellAppearCompleteHandler, false0true);
  254.     }
  255.     private function setDepth(cell:ImgCell):void 
  256.     {
  257.         var scale:Number = Math.random() + 0.01;
  258.         cell.scaleX = cell.scaleY = scale * 1.4 + 0.2;
  259.         cell.y =  laneHeight * scale;
  260.         sortDepth();
  261.     }
  262.     private function sortDepth():void 
  263.     {
  264.         var num:uint = imgContainer.numChildren;
  265.         var cells:Array = new Array();
  266.         while (num--) cells.unshift(imgContainer.getChildAt(num));
  267.         cells.sortOn("y"Array.NUMERIC);    
  268.         num = cells.length;
  269.         while (num--) imgContainer.setChildIndex(cells[num], 0);
  270.     }
  271.     private function cellAppearCompleteHandler(e:Event):void 
  272.     {
  273.         var cell:ImgCell = e.target as ImgCell;
  274.         cell.removeEventListener("appeared", cellLoadCompleteHandler);
  275.         cell.addEventListener("out", cellOutHandler);
  276.     }
  277.     private function cellOutHandler(e:Event):void 
  278.     {
  279.         var cell:ImgCell = e.target as ImgCell;
  280.         cell.x = laneWidth + cell.width;
  281.         setDepth(cell);
  282.     }
  283.     private function setBlurs(e:Event):void 
  284.     {
  285.         var num:uint = imgContainer.numChildren;
  286.         while (num--) {
  287.             var cell:ImgCell = imgContainer.getChildAt(num) as ImgCell;
  288.             var mx:Number = Math.abs(cell.mouseX) / cell.width;
  289.             var my:Number = Math.abs(cell.mouseY+cell.height/2) / cell.height;
  290.             
  291.             var r:Number = Math.sqrt(mx * mx + my * my);
  292.             if (r < 1) r *=r;
  293.             
  294.             var b:Number = Math.min(100 * cell.scaleX, r *  6 * cell.scaleX);
  295.             
  296.             cell.filters = 
  297.             [
  298.                 new BlurFilter(b,b,1)
  299.             ];
  300.         }
  301.     }
  302. }
  303. import flash.display.BitmapData
  304. import flash.display.Bitmap;
  305. import flash.filters.DropShadowFilter;
  306. import flash.filters.GlowFilter;
  307. class Film
  308. extends Sprite
  309. {
  310.     public var moveX:Number;
  311.     public var moveY:Number;
  312.     public function Film(bd:BitmapData):void 
  313.     {
  314.         var bmp:Bitmap = new Bitmap(bd);
  315.         graphics.beginFill(0xFFFFFF);
  316.         graphics.drawRect( -70, -70140140);
  317.         bmp.x = -60;
  318.         bmp.y = -45;
  319.         rotation = Math.random()*30-15;
  320.         scaleX = scaleY = Math.random()*1+0.5;
  321.         addChild(bmp);
  322.         filters = [
  323.             new DropShadowFilter(width * 0.054500.30, width * 0.15, height * 0.15), 
  324.             new GlowFilter(0xCCCCCC, 1.0, width * 0.04, height * 0.04)
  325.         ];        
  326.         
  327.         moveX = Math.random() * 4 -2;
  328.         moveY = -(Math.random() * 4 + 5);
  329.     }
  330. }
  331. class ImgCell
  332. extends Sprite
  333. {
  334.     private var img:Loader;    
  335.     private var maskSp:Sprite = new Sprite();
  336.     private var hole:Sprite = new Sprite();
  337.     
  338.     public function ImgCell(url:String):void 
  339.     {
  340.         //loader
  341.         img = new Loader();
  342.         img.contentLoaderInfo.addEventListener(Event.COMPLETE, loadCompleteHandler);
  343.         img.load(new URLRequest(url));
  344.     }
  345.     private function loadCompleteHandler(e:Event):void 
  346.     {
  347.         img.x = -img.width / 2
  348.         maskSp.graphics.beginFill(0);
  349.         maskSp.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  350.         maskSp.graphics.drawRect(-img.width/2, -img.height, img.width, img.height);
  351.         
  352.         hole.graphics.beginFill(0x110909);
  353.         hole.graphics.drawEllipse(-img.width/2, -img.height/8, img.width, img.height / 4);
  354.         hole.y = maskSp.y = 0//-hole.height/2;
  355.         
  356.         img.mask = maskSp;
  357.         
  358.         addChild(hole);
  359.         addChild(img);
  360.         addChild(maskSp);
  361.         //
  362.         visible = true;
  363.         dispatchEvent(new Event("loaded"));
  364.         
  365.         hole.scaleX = hole.scaleY = 0.1;
  366.         Tweener.addTween(hole, {
  367.             scaleX: 1,
  368.             scaleY: 1,
  369.             time: 0.5,
  370.             transition: "easeOutQuint"
  371.         });
  372.         
  373.         img.y = img.height*0.5;
  374.         Tweener.addTween(img, {
  375.             y: -img.height,
  376.             time: 0.2 + Math.random() * 0.5,
  377.             delay:0.1,
  378.             transition: "easeOutCubic",
  379.             onComplete: appearCompleteHandler
  380.         });
  381.     }
  382.     private function appearCompleteHandler():void 
  383.     {
  384.         Tweener.addTween(hole, {
  385.             scaleX: 0.1,
  386.             scaleY: 0.1,
  387.             time: 0.2,
  388.             transition: "easeInQuint",
  389.             onComplete: holeCompleteHandler
  390.         });
  391.     }
  392.     private function holeCompleteHandler():void 
  393.     {
  394.         removeChild(hole);
  395.         removeChild(maskSp);
  396.         img.mask = null;
  397.         hole = maskSp = null;
  398.         dispatchEvent(new Event("appeared"));
  399.         
  400.         addEventListener(Event.ENTER_FRAME, enterFrameHandler, false0true);
  401.     }
  402.     private function enterFrameHandler(e:Event):void 
  403.     {
  404.         x -= width * 0.01;// (Math.random() * 1 + 1) * 0.01;
  405.         if (x + width / 2 < 0) dispatchEvent(new Event("out"));
  406.     }
  407. }
noswf
Get Adobe Flash Player