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

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

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


forked from : checkmate's Checkmate vol.5 Amateur [diff(301)]

FAVORITE BY
:
手がぁ・・・
:
ホイールの使い方
:
kawaii!
:
なでたくないw
:
うわあああああ
FORKED
  1. // forked from osamX's なでなでワンコ
  2. // forked from checkmate's Checkmate vol.5 Amateur
  3. /**
  4.  * 遊び方:
  5.  * 1. フルスクリーンにします。
  6.  * 2. マウスが右向きになるように置きます。
  7.  * 3. マウスを左手で押さえます。
  8.  * 4. 右手をマウスホイールの上に置き、左右に動かします。
  9.  * 5. 左クリック、ホイールクリックしてみると...?
  10.  * 
  11.  *  ソースはメッチャクチャのグッチャグチャ。あんまり見ないでね。
  12.  */
  13. package {
  14.     import flash.display.*;
  15.     import flash.events.*;
  16.     import flash.utils.*;
  17.     import flash.net.*;
  18.     import flash.system.*;
  19.     import jp.progression.commands.*;
  20.     import jp.progression.commands.lists.*;
  21.     import jp.progression.commands.display.*;
  22.     import jp.progression.commands.net.*;
  23.     import jp.progression.commands.tweens.*;
  24.     import jp.progression.events.*;
  25.     
  26.     import org.libspark.betweenas3.BetweenAS3;
  27.     import org.libspark.betweenas3.easing.*;
  28.     import org.libspark.betweenas3.tweens.ITween;
  29.     import org.libspark.betweenas3.events.TweenEvent;
  30.     import flash.system.Security;
  31.     
  32.     public class Nadenade extends Sprite {
  33.         public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate05/wancoProfessional.swf";
  34.         
  35.         public var stayMotion:MovieClip;
  36.         public var jumpMotion:MovieClip;
  37.         public var highJumpMotion:MovieClip;
  38.         public var walkMotion:MovieClip;
  39.         public var runMotion:MovieClip;
  40.         public var squatMotion:MovieClip;
  41.         public var questionMotion:MovieClip;
  42.         public var exclamationMotion:MovieClip;
  43.         public var heartMotion:MovieClip;
  44.         public var poutMotion:MovieClip;
  45.         public var starMotion:MovieClip;
  46.         public var singMotion:MovieClip;
  47.         public var sleepMotion:MovieClip;
  48.         public var wakeMotion:MovieClip;
  49.         
  50.         private const SIZE:uint = 465;
  51.         private var hand:MyHand;
  52.         private var lc:LocalConnectionEx;
  53.         private var motionList:Array;
  54.         private var guchaflg:Boolean = false;
  55.         private var singflg:Boolean = false;
  56.         private var achaflg:Boolean = false;
  57.         private var lastAchaTime:int;
  58.         
  59.         private const HX:Number = 0;
  60.         private const HY:Number = 50;
  61.         
  62.         public function Nadenade () {
  63.             super();
  64.             //Security.allowDomain("flash-scope.com");
  65.             stage.scaleMode = StageScaleMode.NO_SCALE;
  66.             stage.align = StageAlign.TOP_LEFT;
  67.             var com:SerialList = new SerialList();
  68.             com.addCommand(
  69.                 new LoadSWF( new URLRequest( GRAPHICS_URL ) ),
  70.                 function():void {
  71.                     var loader:Loader = Loader( this.latestData );
  72.                     var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
  73.                     
  74.                     stayMotion = new ( domain.getDefinition( "StayMotion" ) as Class );
  75.                     jumpMotion = new ( domain.getDefinition( "JumpMotion" ) as Class );
  76.                     highJumpMotion = new ( domain.getDefinition( "HighJumpMotion" ) as Class );
  77.                     walkMotion = new ( domain.getDefinition( "WalkMotion" ) as Class );
  78.                     runMotion = new ( domain.getDefinition( "RunMotion" ) as Class );
  79.                     squatMotion = new ( domain.getDefinition( "SquatMotion" ) as Class );
  80.                     questionMotion = new ( domain.getDefinition( "QuestionMotion" ) as Class );
  81.                     exclamationMotion = new ( domain.getDefinition( "ExclamationMotion" ) as Class );
  82.                     heartMotion = new ( domain.getDefinition( "HeartMotion" ) as Class );
  83.                     poutMotion = new ( domain.getDefinition( "PoutMotion" ) as Class );
  84.                     starMotion = new ( domain.getDefinition( "StarMotion" ) as Class );
  85.                     singMotion = new ( domain.getDefinition( "SingMotion" ) as Class );
  86.                     sleepMotion = new ( domain.getDefinition( "SleepMotion" ) as Class );
  87.                     wakeMotion = new ( domain.getDefinition( "WakeMotion" ) as Class );
  88.                 },
  89.                 hand = new MyHand()
  90.             );
  91.             com.addEventListener(ExecuteEvent.EXECUTE_COMPLETE,onLoadSWF);
  92.             com.execute();
  93.         }
  94.         
  95.         private function onLoadSWF(e:Event):void {
  96.             motionList = [
  97.                 stayMotion,        //0
  98.                 walkMotion,        //1
  99.                 runMotion,        //2
  100.                 squatMotion,    //3
  101.                 questionMotion,    //4
  102.                 exclamationMotion,//5
  103.                 heartMotion,    //6
  104.                 poutMotion,        //7
  105.                 singMotion,        //8
  106.                 sleepMotion,    //9
  107.                 wakeMotion        //10
  108.             ];
  109.             
  110.             for eachvar motion:MovieClip in motionList ) {
  111.                 addChild(motion);
  112.                 motion.x = SIZE / 2;
  113.                 motion.y = SIZE / 2 + 100;
  114.                 motion.scaleX = motion.scaleY = 3;
  115.             }
  116.             freeMotion();
  117.             
  118.             hand.x = HX;
  119.             hand.y = HY;
  120.             hand.alpha = 0;
  121.             addChild(hand);
  122.             var handframe:int = 0;
  123.             var cnt:int = 0;
  124.             var lastNadeTime:int;
  125.             const SPEED:uint = 2;
  126.             var buruburu:Boolean = false;
  127.             stage.addEventListener(MouseEvent.MOUSE_WHEEL, function(e:MouseEvent):void {
  128.                 resetHand();
  129.                 if (!singflg && !achaflg) {
  130.                     if (e.delta > 0) cnt++;
  131.                     else if (e.delta < 0) cnt--;
  132.                     if (Math.abs(cnt) >= SPEED) {
  133.                         handframe += int(cnt / SPEED);
  134.                         cnt = 0;
  135.                         if (handframe < 0) handframe = 0;
  136.                         else if (handframe > 4) handframe = 4;
  137.                     }
  138.                     hand.show(handframe);
  139.                     hand.alpha = 0.6;
  140.                     lastNadeTime = getTimer();
  141.                     showMotion(6);
  142.                 }
  143.             });
  144.             wheelClickHandler();
  145.             var timer:Timer = new Timer(200);
  146.             timer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
  147.                 if (!achaflg && !guchaflg && hand.alpha > 0 && getTimer() - lastNadeTime > 500) {
  148.                     hand.alpha -= 0.1;
  149.                     if (hand.alpha <= 0) freeMotion();
  150.                 }
  151.                 if (achaflg) {
  152.                     buruburu = !buruburu;
  153.                     if (buruburu) hand.x = HX + 10;
  154.                     else hand.x = HX;
  155.                 }
  156.             });
  157.             timer.start();
  158.         }
  159.         
  160.         private function wheelClickHandler():void {
  161.             var loader:Loader = new Loader();
  162.             var request:URLRequest = new URLRequest("http://flash-scope.com/wonderfl/ClickTest/mouse.swf");
  163.             loader.load(request);
  164.             
  165.             lc = new LocalConnectionEx();
  166.             lc.allowDomain('*');
  167.             lc.connect("_wonderflconnection");
  168.             
  169.             var frame:int = 1;
  170.             var guchaNum:uint = 0;
  171.             
  172.             lc.leftDown = function():void {
  173.                 if (!singflg && !guchaflg) {
  174.                     resetHand();
  175.                     showMotion(8);
  176.                     addEventListener(Event.ENTER_FRAME, function(e:Event):void {
  177.                         if (!singflg) { //do once
  178.                             singMotion.gotoAndPlay(1);
  179.                             singMotion.wc2.wc3.gotoAndPlay(2);
  180.                             singflg = true;
  181.                         }
  182.                         frame++;
  183.                         if (frame > 31) {
  184.                             singflg = false;
  185.                             frame = 1;
  186.                             singMotion.stop();
  187.                             removeEventListener(Event.ENTER_FRAME, arguments.callee);
  188.                             freeMotion();
  189.                         }
  190.                     });
  191.                 }
  192.             };
  193.             
  194.             lc.wheelDown = function():void {
  195.                 resetHand();
  196.                 if (!guchaflg && !achaflg) {
  197.                     showMotion(10);
  198.                     guchaflg = true;
  199.                     hand.alpha = 0.6;
  200.                     BetweenAS3.parallel(
  201.                         BetweenAS3.tween(hand, {y:120},null,0.1),
  202.                         BetweenAS3.tween(wakeMotion, { height:50, width:250 }, null0.3, Back.easeOutWith(5.0))
  203.                     ).play();
  204.                 }
  205.             };
  206.             
  207.             lc.wheelUp = function():void {
  208.                 if(guchaflg && !achaflg){
  209.                     var tween:ITween = BetweenAS3.tween(wakeMotion, { height:55.8 * 3, width:60.45 * 3 }, null0.5, Elastic.easeOut);
  210.                     tween.addEventListener(TweenEvent.COMPLETE, function(e:TweenEvent):void {
  211.                         freeMotion();
  212.                         guchaflg = false;
  213.                         if (++guchaNum >= 5) {
  214.                             lastAchaTime = getTimer();
  215.                             guchaNum = 0;
  216.                             hand.show(5);
  217.                             hand.alpha = 1;
  218.                             achaflg = true;
  219.                             showMotion(4);
  220.                         }
  221.                     });
  222.                     BetweenAS3.parallel(
  223.                         BetweenAS3.tween(hand, {y:HY},null,0.05),
  224.                         tween
  225.                     ).play();
  226.                 }
  227.             };
  228.         }
  229.         
  230.         private function showMotion(num:uint):void {
  231.             var i:uint = 0;
  232.             for eachvar motion:MovieClip in motionList ) {
  233.                 if (i++ == num) {
  234.                     motion.visible = true;
  235.                     //motion.stop();
  236.                 }else {
  237.                     motion.visible = false;
  238.                     //motion.gotoAndPlay(1);
  239.                 }
  240.             }
  241.         }
  242.         
  243.         private function freeMotion():void {
  244.             var num:uint = int(Math.random() * 8);
  245.             switch(num) {
  246.                 case 6: num = 7break;
  247.                 case 7: num = 9break;
  248.             }
  249.             showMotion(num);
  250.         }
  251.         
  252.         private function resetHand():void {
  253.             if (achaflg && getTimer()-lastAchaTime>2000) {
  254.                 hand.x = HX;
  255.                 achaflg = false;
  256.                 hand.show(0);
  257.                 hand.alpha = 0;
  258.             }
  259.         }
  260.         
  261.     }
  262. }
  263. import flash.display.Loader;
  264. import flash.display.Sprite;
  265. import flash.net.URLRequest;
  266. import flash.events.Event;
  267. import flash.system.LoaderContext;
  268. class MyHand extends Sprite 
  269. {
  270.     public var images:Array = [];
  271.     public function MyHand():void 
  272.     {
  273.         for (var i:uint = 1; i <= 6; i++){
  274.             var loader:Loader = new Loader();
  275.             loader.load(new URLRequest("http://flash-scope.com/wonderfl/Wanco/img"+i+".png"), new LoaderContext(true));
  276.             images.push(loader);
  277.             addChild(images[i - 1]);
  278.         }
  279.         show(0);
  280.     }
  281.     public function show(num:uint):void {
  282.         for (var i:uint = 0; i < 6; i++) {
  283.             if(i==num) images[i].visible = true;
  284.             else images[i].visible = false;
  285.         }
  286.         
  287.     }
  288. }
  289. import flash.net.LocalConnection; 
  290. dynamic class LocalConnectionEx extends LocalConnection  
  291. {
  292. }
noswf
Get Adobe Flash Player