forked from: 写真のスライド
/**
* Copyright yskick ( http://wonderfl.net/user/yskick )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/q6Nn
*/
// forked from simultechnology's 写真のスライド
package
{
import caurina.transitions.Tweener;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
[SWF(backgroundColor="0x000000")]
public class Slide extends Sprite
{
private var _loaderArray:Array = [];
public function Slide()
{
var fileArray:Array = [
"http://assets.wonderfl.net/images/related_images/e/e8/e80c/e80cb8272f7ca51955730f198dcd46bf72682eea",
"http://assets.wonderfl.net/images/related_images/9/95/954f/954feb955326b6ab74c760d625a9cb20dd0b1db5",
"http://assets.wonderfl.net/images/related_images/1/1b/1bcd/1bcdd1d7dc210c6cc05347729c162ce5fee5c587",
"http://assets.wonderfl.net/images/related_images/1/15/1570/1570ca63ab3a18a888b62ae25364fbfed9d50773",
"http://assets.wonderfl.net/images/related_images/1/15/15a8/15a8943d8da6fdbf2226448afa3316a07598bad9",
"http://assets.wonderfl.net/images/related_images/7/78/78f9/78f9fb3188b9a8b2f25883578484c8de25b89b81",
"http://assets.wonderfl.net/images/related_images/b/b0/b0da/b0da3c3a13a947110761a320204df79298b85971",
"http://assets.wonderfl.net/images/related_images/7/70/70a0/70a04111f14b07855a96ef9acef998d64df0fb78",
"http://assets.wonderfl.net/images/related_images/a/a6/a692/a692d615563f57d4df9e141706ead47f4c171552",
"http://assets.wonderfl.net/images/related_images/9/90/9074/9074ba908dd758a5c8f50bc003fdcbc91b91a6f5",
"http://assets.wonderfl.net/images/related_images/2/20/208d/208d155849b660677c4bdc4fa9b05a39c86929a8",
"http://assets.wonderfl.net/images/related_images/2/27/2765/2765127fce9d98461580367b776effb6ece4a433",
"http://assets.wonderfl.net/images/related_images/3/32/328d/328d86afc9eca9fe67e34e7a4a448133109a64e7",
"http://assets.wonderfl.net/images/related_images/7/70/704e/704ec56b47464afb3fb57f7311b5a3bf15e941d8",
"http://assets.wonderfl.net/images/related_images/c/c6/c620/c620fd8f701fba4d8afe8f8ed625df24fd4f452f",
"http://assets.wonderfl.net/images/related_images/a/aa/aac2/aac2ecfa9549e38aaf43ad05a66b053fc8b5521b",
"http://assets.wonderfl.net/images/related_images/4/4b/4b86/4b8697dee39fcf3028511ca43b68698f935e92a0",
"http://assets.wonderfl.net/images/related_images/2/25/25ec/25ec137d49138e33f435b6b132c534342c8d9c0c",
"http://assets.wonderfl.net/images/related_images/6/6f/6f6e/6f6ebf940e2d9fa831b630dd51d47232cca9c6cd",
"http://assets.wonderfl.net/images/related_images/6/67/67f5/67f58563be342f1eca940b075eb4e4700715c6fa"
]
var loader:Loader;
var uRLRequest:URLRequest;
var n:int = fileArray.length;
for (var i:int = 0; i < n; i++) {
loader = new Loader();
uRLRequest = new URLRequest(fileArray[i]);
loader.load(uRLRequest);
loader.scaleX = 0.1;
loader.scaleY = 0.1;
loader.y = Math.random() * 465;
loader.x = 50 * i;
loader.alpha = 0.6;
loader.addEventListener(MouseEvent.MOUSE_OVER, completeListener);
_loaderArray.push(loader);
addChild(loader);
}
this.stage.addEventListener(MouseEvent.CLICK, completeListener);
}
private function completeListener(e:Event):void {
var dx:int;
var dy:int;
var destination:int;
var len:int = _loaderArray.length;
for (var i:int = 0; i < len; i++) {
destination = 0;
dx = 0;
dy = 0;
dx = _loaderArray[i].x;
dy = _loaderArray[i].y;
destination = dx + Math.random() * 465 / 2;
trace(dx);
if (destination > 465) {
Tweener.addTween(_loaderArray[i], { x:465, y:dy, time:3, transition:"easeOutBack" });
_loaderArray[i].x = 0;
Tweener.addTween(_loaderArray[i], { x:destination - 465, y:dy, time:3, transition:"easeOutBack" });
}
else {
Tweener.addTween(_loaderArray[i], { x:destination, y:dy, time:3, transition:"easeOutBack" });
}
}
}
}
}