Posted By

daisuke103 on 02/11/08


Tagged

image textmate load change as2 stage mdn trans


Versions (?)

AS2 MdN ランダムにトランジション 画面遷移ライブラリ


 / Published in: Other
 

  1. /* ここから */
  2. /*
  3. ランダムなトランジション
  4. ランダムに画面を切り替える実行部分とライブラリ
  5. まず15の画像をロード
  6. */
  7.  
  8. /* ここから 実行部分 */
  9. import mx.transitions.*;
  10. import mx.transitions.easing.*;
  11.  
  12. var cnt:Number = 0;
  13. var index:Number = 0;
  14. var imageArray:Array = new Array();
  15. var base_mc:MovieClip = this.createEmptyMovieClip("base_mc", 1);
  16. var mclListener:Object = new Object();
  17. var image_mcl:MovieClipLoader = new MovieClipLoader();
  18. image_mcl.addListener(mclListener);
  19.  
  20. for (var i=0; i<5; i++) {
  21. var mc1:MovieClip = this.createEmptyMovieClip("image_mc1"+i,10+i);
  22. var mc2:MovieClip = mc1.createEmptyMovieClip("image_mc2"+i, 100+i);
  23.  
  24. image_mcl.loadClip(1+i+".jpg", mc2);
  25. }
  26.  
  27. mclListener.onLoadInit = function(mc:MovieClip) {
  28. base_mc._x=5;
  29. base_mc._y=5;
  30. mc._x=-mc._width/2;
  31. mc._y=-mc._height/2;
  32. mc._parent._x=mc._width/2;
  33. mc._parent._y=mc._height/2;
  34. mc._visible=false;
  35. imageArray.push (mc)
  36. imageArray.sort (16)
  37.  
  38. if(cnt==4){
  39. set_c(base_mc,[1,0x000000,100],[0xffffff,100],mc._height,mc._width)
  40. setImage(mc);
  41. }
  42. cnt++;
  43. };
  44.  
  45. function upData():Void {
  46.  
  47. index++;
  48. index %= imageArray.length;
  49. firstImage(imageArray[index])
  50.  
  51. }
  52.  
  53. function firstImage(mc:MovieClip):Void {
  54.  
  55. mc._visible=true;
  56. mc._parent.swapDepths( this.getNextHighestDepth())
  57. img_go(mc)
  58.  
  59. }
  60.  
  61. function setImage(mc:MovieClip):Void {
  62. var startTime:Number;
  63. var timeOut:Number = 1000;
  64. startTime= getTimer();
  65. base_mc.onEnterFrame = function(){
  66. if(getTimer() > startTime+timeOut){
  67. var tt=(0-this._x)/3;
  68. var hh=(0-this._y)/3
  69. if(Math.abs(tt)<0.1 && Math.abs(hh)<0.1 ){
  70. this._x =0;
  71. this._y =0;
  72. delete this.onEnterFrame;
  73. drop(this);
  74. firstImage(mc);
  75. SlideImageID=setInterval(upData,5000);
  76. }else{
  77. this._x += tt;
  78. this._y += hh;
  79.  
  80. }
  81. }
  82.  
  83. }
  84. }
  85.  
  86. function goOut(mc:MovieClip):Void{
  87.  
  88. var myTween4:Tween= new Tween(mc._parent, "_alpha", Strong.easeIn, 100, 0, 8, true);
  89.  
  90. }
  91.  
  92. function set_c(_mc,line_style, fill_style,he,wi):Void {
  93.  
  94. if (line_style)_mc.lineStyle.apply(_mc, line_style);
  95. if (fill_style) _mc.beginFill.apply(_mc, fill_style);
  96.  
  97. _mc.moveTo(0,0);
  98. _mc.lineTo(0, he-1);
  99. _mc.lineTo(wi-1, he-1);
  100. _mc.lineTo(wi-1,0);
  101. _mc.lineTo(0, 0);
  102. if (fill_style) _mc.endFill();
  103.  
  104. }
  105.  
  106. function drop(target_mc:MovieClip):Void{
  107.  
  108. var distance:Number = 5;
  109. var angleInDegrees:Number = 45;
  110. var color:Number = 0x000000;
  111. var alpha:Number = .8;
  112. var blurX:Number = 7;
  113. var blurY:Number = 7;
  114. var strength:Number = 1;
  115. var quality:Number = 3;
  116. var inner:Boolean = false;
  117. var knockout:Boolean = false;
  118. var hideObject:Boolean = false;
  119.  
  120. var filter = new flash.filters.DropShadowFilter(distance,
  121. angleInDegrees,
  122. color,
  123. alpha,
  124. blurX,
  125. blurY,
  126. strength,
  127. quality,
  128. inner,
  129. knockout,
  130. hideObject);
  131. var filterArray:Array = target_mc.filters;
  132. filterArray.push(filter);
  133. target_mc.filters = filterArray;
  134.  
  135. }
  136.  
  137. function img_go(mc:MovieClip):Void {
  138. var imgArray = ["roTra", "phTra", "sqTra", "flyTra", "pdTra","blTra","faTra","irTra","wiTra","zoTra"];
  139. this[imgArray[Math.floor(Math.random()*imgArray.length)]](mc);
  140.  
  141. goOut(mc)
  142. }
  143.  
  144.  
  145. /* ここまで 実行部分 */
  146.  
  147. /* ここから ライブラリ */
  148. import mx.transitions.*;
  149. import mx.transitions.easing.*;
  150.  
  151. function roTra(mc:MovieClip):Void {
  152. var myTween:Tween= new Tween(mc, "_alpha", Strong.easeIn, 0, 100, 2, true);
  153. TransitionManager.start(mc._parent, {type:Rotate, direction:Transition.IN, duration:3, easing:Strong.easeInOut, ccw:false, degrees:720});
  154. }
  155. function phTra(mc:MovieClip):Void {
  156. var myTween1:Tween= new Tween(mc, "_alpha", Strong.easeIn, 0, 100, 10, false);
  157. TransitionManager.start (mc._parent, {type:Photo, direction:Transition.IN, duration:2, easing:Elastic.easeOut});
  158. }
  159. function sqTra(mc:MovieClip):Void {
  160. var myTween2:Tween= new Tween(mc, "_alpha", Strong.easeIn, 0, 100, 10, false);
  161. TransitionManager.start(mc._parent, {type:Squeeze, direction:Transition.IN, duration:3, easing:Elastic.easeOut, dimension:0});
  162. }
  163. function flyTra(mc:MovieClip):Void {
  164. var myTween3:Tween= new Tween(mc, "_alpha", Strong.easeIn, 0, 100, 25, false);
  165. TransitionManager.start(mc._parent, {type:Fly, direction:Transition.IN, duration:3, easing:Elastic.easeOut, startPoint:9});
  166. }
  167. function pdTra(mc:MovieClip):Void {
  168.  
  169. TransitionManager.start(mc._parent, {type:PixelDissolve, direction:Transition.IN, duration:2, easing:None.easeNone, xSections:20, ySections:20});
  170.  
  171. }
  172. function blTra(mc:MovieClip):Void {
  173.  
  174. TransitionManager.start(mc._parent, {type:Blinds, direction:Transition.IN, duration:2, easing:None.easeNone, numStrips:15, dimension:1});
  175.  
  176. }
  177. function faTra(mc:MovieClip):Void {
  178.  
  179. TransitionManager.start(mc, {type:Fade, direction:Transition.IN, duration:3, easing:Strong.easeIn});
  180.  
  181. }
  182. function wiTra(mc:MovieClip):Void {
  183.  
  184. TransitionManager.start(mc._parent, {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:1});
  185.  
  186. }
  187. function irTra(mc:MovieClip):Void {
  188.  
  189. TransitionManager.start(mc._parent, {type:Iris, direction:Transition.IN, duration:2, easing:Strong.easeOut, startPoint:5, shape:Iris.CIRCLE});
  190.  
  191. }
  192. function zoTra(mc:MovieClip):Void {
  193.  
  194. TransitionManager.start(mc._parent, {type:Zoom, direction:Transition.IN, duration:2, easing:Elastic.easeOut});
  195.  
  196. }
  197. /* ここまで ライブラリ */

Report this snippet  

You need to login to post a comment.