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


embed

FORKED
  1. // forked from beinteractive's 1. Simple tweens with BetweenAS3
  2. package
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.text.TextField;
  6.     import flash.events.MouseEvent;
  7.     import org.libspark.betweenas3.BetweenAS3;
  8.     
  9.     public class Sample extends Sprite
  10.     {
  11.         public function Sample()
  12.         {
  13.             (addChild(new TextField()) as TextField).text = 'Click to start';
  14.             stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
  15.         }
  16.         
  17.         private function mouseUpHandler(e:MouseEvent):void
  18.         {
  19.             while (numChildren > 0) {
  20.                 removeChildAt(0);
  21.             }
  22.             
  23.             var box1:Box = addNewBox(50);
  24.             var box2:Box = addNewBox(150);
  25.             var box3:Box = addNewBox(250);
  26.             var box4:Box = addNewBox(350);
  27.             
  28.             // Parameters are:
  29.             // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
  30.             
  31.             // Simple Tween: from current (20) to 220
  32.             BetweenAS3.tween(box1, {x: 220}).play();
  33.             
  34.             // From-To Tween: from 120 to 220
  35.             BetweenAS3.tween(box2, {x: 320}, {x: 120}).play();
  36.             
  37.             // From Tween: from 220 to current (20)
  38.             BetweenAS3.tween(box3, null, {x: 220}).play();
  39.             
  40.             // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
  41.             BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play(); 
  42.         }
  43.         
  44.         private function addNewBox(y:Number):Box
  45.         {
  46.             var box:Box = new Box();
  47.             box.x = 20;
  48.             box.y = y;
  49.             addChild(box);
  50.             return box;
  51.         }
  52.     }
  53. }
  54. import flash.display.Sprite;
  55. internal class Box extends Sprite
  56. {
  57.     public function Box()
  58.     {
  59.         graphics.beginFill(0);
  60.         graphics.drawRect(-10, -102020);
  61.         graphics.endFill();
  62.     }
  63. }
noswf
  1. // forked from beinteractive's 1. Simple tweens with BetweenAS3
  2. package
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.text.TextField;
  6.     import flash.events.MouseEvent;
  7.     import org.libspark.betweenas3.BetweenAS3;
  8.     
  9.     public class Sample extends Sprite
  10.     {
  11.         public function Sample()
  12.         {
  13.             (addChild(new TextField()) as TextField).text = 'Click to start';
  14.             stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
  15.         }
  16.         
  17.         private function mouseUpHandler(e:MouseEvent):void
  18.         {
  19.             while (numChildren > 0) {
  20.                 removeChildAt(0);
  21.             }
  22.             
  23.             var box1:Box = addNewBox(50);
  24.             var box2:Box = addNewBox(150);
  25.             var box3:Box = addNewBox(250);
  26.             var box4:Box = addNewBox(350);
  27.             
  28.             // Parameters are:
  29.             // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
  30.             
  31.             // Simple Tween: from current (20) to 220
  32.             BetweenAS3.tween(box1, {x: 220}).play();
  33.             
  34.             // From-To Tween: from 120 to 220
  35.             BetweenAS3.tween(box2, {x: 220}, {x: 120}).play();
  36.             
  37.             // From Tween: from 220 to current (20)
  38.             BetweenAS3.tween(box3, null, {x: 220}).play();
  39.             
  40.             // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
  41.             BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
  42.         }
  43.         
  44.         private function addNewBox(y:Number):Box
  45.         {
  46.             var box:Box = new Box();
  47.             box.x = 20;
  48.             box.y = y;
  49.             addChild(box);
  50.             return box;
  51.         }
  52.     }
  53. }
  54. import flash.display.Sprite;
  55. internal class Box extends Sprite
  56. {
  57.     public function Box()
  58.     {
  59.         graphics.beginFill(0);
  60.         graphics.drawRect(-10, -102020);
  61.         graphics.endFill();
  62.     }
  63. }
noswf
  1. // forked from beinteractive's 1. Simple tweens with BetweenAS3
  2. package
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.text.TextField;
  6.     import flash.events.MouseEvent;
  7.     import org.libspark.betweenas3.BetweenAS3;
  8.     import org.libspark.betweenas3.easing.*;
  9.     import org.libspark.betweenas3.tweens.ITween;
  10.     
  11.     public class Sample extends Sprite
  12.     {
  13.         public function Sample()
  14.         {
  15.             (addChild(new TextField()) as TextField).text = 'Click to start';
  16.             stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
  17.         }
  18.         
  19.         private function mouseUpHandler(e:MouseEvent):void
  20.         {
  21.             while (numChildren > 0) {
  22.                 removeChildAt(0);
  23.             }
  24.             //下記で作ったクラスを利用
  25.             var box1:Box = addNewBox(50);
  26.             var box2:Box = addNewBox(150);
  27.             var box3:Box = addNewBox(250);
  28.             var box4:Box = addNewBox(350);
  29.             var box5:Box = addNewBox(450); 
  30.             
  31.             // Parameters are:
  32.             // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
  33.             
  34.             // Simple Tween: from current (20) to 220
  35.             var t1:ITween = BetweenAS3.tween(box1, {x: 220},null,1.0, Back.easeOut);
  36.              //1秒遅れてt1がスタートする。
  37.              BetweenAS3.delay(t1,1.0).play(); 
  38.             
  39.             // From-To Tween: from 120 to 220
  40.             var t2:ITween = BetweenAS3.tween(box2, {x: stage.stageWidth -20}, {x: 20},1.0, Cubic.easeInOut);
  41.             t2.play();
  42.             
  43.             BetweenAS3.serial(
  44.             BetweenAS3.tween(box3, null, {x: 220},4.0),
  45.             BetweenAS3.tween(box4, {$x: 200}, {$x: 10},3.0,Elastic.easeOut)
  46.             ).play();
  47.             
  48.             var t5:ITween = BetweenAS3.tween(box5,{y:400},null,1.0,Cubic.easeOut);
  49.             BetweenAS3.repeat(t5,3).play();  
  50.         } 
  51.         
  52.         
  53.         
  54.         private function addNewBox(y:Number):Box 
  55.         {
  56.             var box:Box = new Box(); //下記で作ったクラスを使っている
  57.             box.x = 10;
  58.             box.y = y;
  59.             addChild(box);
  60.             return box;
  61.         }
  62.     }
  63. }
  64. import flash.display.Sprite;
  65. internal class Box extends Sprite
  66. {
  67.     public function Box()
  68.     {
  69.         graphics.beginFill(Math.random()* 0xffffff);
  70.         graphics.drawRect(-10, -102020);
  71.         graphics.endFill();
  72.     }
  73. }
noswf
  1. // forked from beinteractive's 1. Simple tweens with BetweenAS3
  2. package
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.text.TextField;
  6.     import flash.events.MouseEvent;
  7.     import org.libspark.betweenas3.BetweenAS3;
  8.     
  9.     public class Sample extends Sprite
  10.     {
  11.         public function Sample()
  12.         {
  13.             (addChild(new TextField()) as TextField).text = 'Click to start';
  14.             stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
  15.         }
  16.         
  17.         private function mouseUpHandler(e:MouseEvent):void
  18.         {
  19.             while (numChildren > 0) {
  20.                 removeChildAt(0);
  21.             }
  22.             
  23.             var box1:Box = addNewBox(50);
  24.             var box2:Box = addNewBox(150);
  25.             var box3:Box = addNewBox(250);
  26.             var box4:Box = addNewBox(350);
  27.             
  28.             // Parameters are:
  29.             // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
  30.             
  31.             // Simple Tween: from current (20) to 220
  32.             BetweenAS3.tween(box1, {x: 220}).play();
  33.             
  34.             // From-To Tween: from 120 to 220
  35.             BetweenAS3.tween(box2, {x: 220}, {x: 120}).play();
  36.             
  37.             // From Tween: from 220 to current (20)
  38.             BetweenAS3.tween(box3, null, {x: 220}).play();
  39.             
  40.             // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
  41.             BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
  42.         }
  43.         
  44.         private function addNewBox(y:Number):Box
  45.         {
  46.             var box:Box = new Box();
  47.             box.x = 20;
  48.             box.y = y;
  49.             addChild(box);
  50.             return box;
  51.         }
  52.     }
  53. }
  54. import flash.display.Sprite;
  55. internal class Box extends Sprite
  56. {
  57.     public function Box()
  58.     {
  59.         graphics.beginFill(0);
  60.         graphics.drawRect(002020);
  61.         graphics.endFill();
  62.     }
  63. }
noswf
  1. // forked from beinteractive's 1. Simple tweens with BetweenAS3
  2. package
  3. {
  4.     import flash.display.Sprite;
  5.     import flash.text.TextField;
  6.     import flash.events.MouseEvent;
  7.     import org.libspark.betweenas3.BetweenAS3;
  8.     
  9.     public class Sample extends Sprite
  10.     {
  11.         public function Sample()
  12.         {
  13.             (addChild(new TextField()) as TextField).text = 'Click to start';
  14.             stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
  15.         }
  16.     
  17.         private function mouseUpHandler(e:MouseEvent):void
  18.         {
  19.             while (numChildren > 0) {
  20.                 removeChildAt(0);
  21.             }
  22.             
  23.             var box1:Box = addNewBox(50);
  24.             var box2:Box = addNewBox(150);
  25.             var box3:Box = addNewBox(250);
  26.             var box4:Box = addNewBox(350);
  27.             
  28.             // Parameters are:
  29.             // .tween(Target, ToValues, FromValues, Time, Easing, Delay)
  30.             
  31.             // Simple Tween: from current (20) to 220
  32.             BetweenAS3.tween(box1, {x: 220}).play();
  33.             
  34.             // From-To Tween: from 120 to 220
  35.             BetweenAS3.tween(box2, {x: 220}, {x: 120}).play();
  36.             
  37.             // From Tween: from 220 to current (20)
  38.             BetweenAS3.tween(box3, null, {x: 220}).play();
  39.             
  40.             // Relative Values (Add $ to prefix): from current + 100 (=120) to current + 200 (=220)
  41.             BetweenAS3.tween(box4, {$x: 200}, {$x: 100}).play();
  42.         }
  43.         
  44.         private function addNewBox(y:Number):Box
  45.         {
  46.             var box:Box = new Box();
  47.             box.x = 20;
  48.             box.y = y;
  49.             addChild(box);
  50.             return box;
  51.         }
  52.     }
  53. }
  54. import flash.display.Sprite;
  55. internal class Box extends Sprite
  56. {
  57.     public function Box()
  58.     {
  59.         graphics.beginFill(0);
  60.         graphics.drawRect(-10, -103020);
  61.         graphics.endFill();
  62.     }
  63. }
noswf
Get Adobe Flash Player