Do The Wanco
長押しでwancoをいっぱいしちゃいます。
*
*
* -参考-
*
* sample 7
* http://wonderfl.net/code/34efee1f82818e7f1022705a17f6ae19296bb7d4
*
/**
* Copyright k3lab ( http://wonderfl.net/user/k3lab )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/gbrB
*/
// forked from checkmate's Checkmate vol.5 Sponser
/**
* 長押しでwancoをいっぱいしちゃいます。
*
*
* -参考-
*
* sample 7
* http://wonderfl.net/code/34efee1f82818e7f1022705a17f6ae19296bb7d4
*
*/
package
{
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.system.ApplicationDomain;
import jp.progression.commands.*;
import jp.progression.commands.lists.*;
import jp.progression.commands.display.*;
import jp.progression.commands.net.*;
import jp.progression.commands.tweens.*;
import jp.progression.events.*;
import jp.progression.data.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.DisplayShortcuts;
import caurina.transitions.properties.CurveModifiers;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
import org.libspark.betweenas3.tweens.ITween;
public class Main extends Sprite
{
public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate05/humanSponser.swf";
public static var GRAPHICS2_URL:String = "http://swf.wonderfl.net/static/assets/checkmate05/wancoAmateur.swf";
public var birthMotion:MovieClip
public var stayMotion:MovieClip;
public var jumpMotion:MovieClip;
public var highJumpMotion:MovieClip;
public var walkMotion:MovieClip;
public var runMotion:MovieClip;
public var squatMotion:MovieClip;
public var questionMotion:MovieClip;
public var exclamationMotion:MovieClip;
public var heartMotion:MovieClip;
public var poutMotion:MovieClip;
public var starMotion:MovieClip;
public var singMotion:MovieClip;
public var sleepMotion:MovieClip;
public var wakeMotion:MovieClip;
private var isDownFlg:Boolean;
private var isDownFlg2:Boolean;
private var motionList:Array;
private var cnt:int;
private var _arrow:Sprite;
public function Main():void
{
DisplayShortcuts.init();
CurveModifiers.init();
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var com:SerialList = new SerialList( null,
new LoaderList( null,
new LoadSWF( new URLRequest( GRAPHICS_URL ) ),
new LoadSWF( new URLRequest( GRAPHICS2_URL ) )
),
function():void {
var loader:Loader = Loader(getResourceById(GRAPHICS_URL).data);
var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
birthMotion = new ( domain.getDefinition( "BirthMotion" ) as Class )
var loader2:Loader = Loader( getResourceById(GRAPHICS2_URL).data );
var domain2:ApplicationDomain = loader2.contentLoaderInfo.applicationDomain;
stayMotion = new ( domain2.getDefinition( "StayMotion" ) as Class );
jumpMotion = new ( domain2.getDefinition( "JumpMotion" ) as Class );
highJumpMotion = new ( domain2.getDefinition( "HighJumpMotion" ) as Class );
walkMotion = new ( domain2.getDefinition( "WalkMotion" ) as Class );
runMotion = new ( domain2.getDefinition( "RunMotion" ) as Class );
squatMotion = new ( domain2.getDefinition( "SquatMotion" ) as Class );
questionMotion = new ( domain2.getDefinition( "QuestionMotion" ) as Class );
exclamationMotion = new ( domain2.getDefinition( "ExclamationMotion" ) as Class );
heartMotion = new ( domain2.getDefinition( "HeartMotion" ) as Class );
poutMotion = new ( domain2.getDefinition( "PoutMotion" ) as Class );
starMotion = new ( domain2.getDefinition( "StarMotion" ) as Class );
singMotion = new ( domain2.getDefinition( "SingMotion" ) as Class );
sleepMotion = new ( domain2.getDefinition( "SleepMotion" ) as Class );
}
);
com.addEventListener(ExecuteEvent.EXECUTE_COMPLETE,onLoadSWF);
com.execute();
}
private function onLoadSWF(e:Event):void {
var s:ITween = BetweenAS3.tween(this, { scaleX:2.5, scaleY:2.5 }, null, 3.5, Linear.easeNone)
var base:ITween = BetweenAS3.serial(s, BetweenAS3.reverse(s));
base.stopOnComplete = false;
base.play();
_arrow = addChild(new Arrow(103, 120)) as Sprite;
_arrow.rotation = 110;
var t:ITween = BetweenAS3.tween(_arrow, { x:98, y:129 }, null, 0.4,Exponential.easeInOut);
t.stopOnComplete = false;
t.play();
addChild(birthMotion);
birthMotion.x = 90;
birthMotion.y = 150;
birthMotion.gotoAndStop(1);
birthMotion.addEventListener( MouseEvent.MOUSE_DOWN, down );
birthMotion.buttonMode = birthMotion.useHandCursor = true;
birthMotion.scaleX = birthMotion.scaleY = 0.5;
motionList = [stayMotion, jumpMotion, highJumpMotion, walkMotion, runMotion, squatMotion, questionMotion, exclamationMotion, heartMotion, poutMotion, starMotion, singMotion, sleepMotion ];
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
stage.addEventListener( MouseEvent.MOUSE_UP, up );
}
private function enterFrameHandler(evt:Event):void {
if (!isDownFlg2) return;
cnt++;
var wancoClass:Class = motionList[cnt%motionList.length].constructor;
var copyWanco:* = new wancoClass();
copyWanco.gotoAndStop(1)
copyWanco.x = 90;
copyWanco.y = 65;
copyWanco.scaleX = copyWanco.scaleY = 0;
addChild(copyWanco);
var endX:Number = Math.random() * stage.stageWidth + stage.stageWidth / 2;
var ctlX:Number = mouseX + (endX - mouseX) / 2;
Tweener.addTween(copyWanco, {
x: endX,
y: stage.stageHeight + 50,
_bezier: [ { x: ctlX, y: 0 } ],
_scale:1,
time: 1,
delay:0.2,
transition: "linear",
onComplete: onTweenComplete,
onCompleteParams: [copyWanco]
});
setChildIndex(birthMotion, numChildren - 1);
}
private function onTweenComplete(c:*):void
{
removeChild(c);
}
private function down(e:MouseEvent):void {
isDownFlg = true;
isDownFlg2 = true;
_arrow.visible = false;
var motion:MovieClip = e.target as MovieClip;
birthMotion.y = 150;
Tweener.addTween(motion, { _frame:32, time:0.5,transition:"linear",onComplete:loop,onCompleteParams:[motion] } );
}
private function loop(mc:MovieClip):void {
Tweener.addTween(mc, { _frame:21, time:0.3,transition:"linear",onComplete:loop2,onCompleteParams:[mc] } );
}
private function loop2(mc:MovieClip):void {
Tweener.addTween(mc, { _frame:32, time:0.3,transition:"linear",onComplete:loop,onCompleteParams:[mc] } );
}
private function up(e:Event):void {
isDownFlg2 = false;
if (!isDownFlg) return;
if (birthMotion.currentFrame > 20) {
Tweener.addTween(birthMotion, { x:130, _frame:55, time:0.8, transition:"linear", onComplete:destroy } );
}else {
Tweener.addTween(birthMotion, { x:130, _frame:55, time:1.4, transition:"linear", onComplete:destroy } );
}
function destroy():void {
birthMotion.gotoAndStop(1);
birthMotion.x = 90;
isDownFlg = false;
_arrow.visible = true;
}
}
}
}
import flash.display.*;
class Arrow extends Sprite {
function Arrow( x:Number, y:Number) {
this.x = x;
this.y = y;
graphics.beginFill(0xFFFFFF, 1);
graphics.lineStyle(1, 0x0);
graphics.moveTo(2, 4);
graphics.lineTo(8, 4);
graphics.lineTo(8, 0);
graphics.lineTo(20, 7);
graphics.lineTo(8, 14);
graphics.lineTo(8, 10);
graphics.lineTo(2, 10);
graphics.lineTo(2, 4);
}
}