Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. import flash.display.BitmapData;
  2. import flash.filters.BlurFilter;
  3. import flash.geom.Matrix;
  4.  
  5. stop();
  6. blurData = new BitmapData(Stage.width+20, Stage.height+20);
  7. blurData.draw(_root, new Matrix(1,0,0,1,10,10));
  8.  
  9. this.createEmptyMovieClip("pre_bgmc",this.getNextHighestDepth());
  10. pre_bgmc._x = -10;
  11. pre_bgmc._y = -10;
  12. pre_bgmc.attachBitmap(blurData,1);
  13. pre_bgmc.filters = [new BlurFilter(10,10,2)];
  14.  
  15. this.createEmptyMovieClip("ploader",this.getNextHighestDepth());
  16. ploader._x = 0;
  17. ploader._y = Stage.height-150;
  18.  
  19. // Create Gradient MC
  20. ploader.createEmptyMovieClip("bgGrad",ploader.getNextHighestDepth());
  21. ploader.bgGrad.cacheAsBitmap = true;
  22. ploader.bgGrad._x = -ploader._x;
  23. ploader.bgGrad._y = Stage.height-ploader._y;
  24.  
  25. // Draw Gradient
  26. with(ploader.bgGrad) {
  27. fillType = "linear";
  28. colors = [0x666666, 0x000000];
  29. alphas = [0, 75];
  30. ratios = [0, 255];
  31. matrix = {matrixType:"box", x:0, y:-200, w:200, h:200, r:90/180*Math.PI};
  32. lineStyle(1, 0x000000, 0);
  33. beginGradientFill(fillType, colors, alphas, ratios, matrix);
  34. moveTo(0, 0);
  35. lineTo(Stage.width, 0);
  36. lineTo(Stage.width, -200);
  37. lineTo(0, -200);
  38. lineTo(0, 0);
  39. endFill();
  40. }
  41.  
  42. // Create Diagonal Lines MC
  43. ploader.createEmptyMovieClip("lines",ploader.getNextHighestDepth());
  44. ploader.lines.cacheAsBitmap = true;
  45. ploader.lines._x = Stage.width;
  46. ploader.lines._y = 80;
  47.  
  48. // Create Lines
  49. ploader.lines.lineStyle(1, 0xFFFFFF);
  50. for (var i=0;i<75;i++) {
  51. ploader.lines.moveTo(i*-5, 0);
  52. ploader.lines.lineTo((i*-5)+50, 50);
  53. }
  54.  
  55. // Create Diagonal Lines Mask
  56. ploader.createEmptyMovieClip("linesMask",ploader.getNextHighestDepth());
  57. ploader.linesMask.cacheAsBitmap = true;
  58.  
  59. // Draw Gradient in Lines Mask
  60. with(ploader.linesMask) {
  61. // Top
  62. fillType = "linear";
  63. colors = [0x000000, 0x000000];
  64. alphas = [0, 80];
  65. ratios = [0, 255];
  66. matrix = {matrixType:"box", x:Stage.width-(65*5), y:0, w:200, h:15, r:0/180*Math.PI};
  67. lineStyle(1, 0x000000, 0);
  68. beginGradientFill(fillType, colors, alphas, ratios, matrix);
  69. moveTo(0, 80);
  70. lineTo(Stage.width, 80);
  71. lineTo(Stage.width, 90);
  72. lineTo(0, 90);
  73. lineTo(0, 80);
  74. endFill();
  75.  
  76. // Bottom
  77. alphas = [0, 25];
  78. lineStyle(1, 0x000000, 0);
  79. beginGradientFill(fillType, colors, alphas, ratios, matrix);
  80. moveTo(0, 90);
  81. lineTo(Stage.width, 90);
  82. lineTo(Stage.width, 130);
  83. lineTo(0, 130);
  84. lineTo(0, 90);
  85. endFill();
  86. }
  87.  
  88. // Create Text Container
  89. ploader.createEmptyMovieClip("tcont",ploader.getNextHighestDepth());
  90. ploader.tcont.cacheAsBitmap = true;
  91. ploader.tcont._x = Stage.width-400;
  92.  
  93. // Create Text
  94. var T = ploader.tcont.createTextField("T",ploader.tcount.getNextHighestDepth(),0,0,400,100);
  95. T.text = "0";
  96. T.selectable = false;
  97.  
  98. function setTextFormat(textObject) {
  99. var format:TextFormat = new TextFormat();
  100. format.size = 100;
  101. format.letterSpacing = 15;
  102. format.font = "Arial Narrow";
  103. format.color = 0xFFFFFF;
  104. format.align = "right";
  105. textObject.setTextFormat(format);
  106. }
  107. setTextFormat(T);
  108.  
  109. // Create Text Mask
  110. ploader.createEmptyMovieClip("tmask",ploader.getNextHighestDepth());
  111. ploader.tmask.cacheAsBitmap = true;
  112. ploader.tmask._x = Stage.width-200;
  113.  
  114. // Draw Gradient in Text Mask
  115. with(ploader.tmask) {
  116. fillType = "linear";
  117. colors = [0x000000, 0x000000];
  118. alphas = [0, 50];
  119. ratios = [0, 255];
  120. matrix = {matrixType:"box", x:0, y:68, w:200, h:15, r:-90/180*Math.PI};
  121. lineStyle(1, 0x000000, 0);
  122. beginGradientFill(fillType, colors, alphas, ratios, matrix);
  123. moveTo(0, 0);
  124. lineTo(200, 0);
  125. lineTo(200, 80);
  126. lineTo(0, 80);
  127. lineTo(0, 0);
  128. endFill();
  129. }
  130.  
  131. // Create Info Text Container
  132. ploader.createEmptyMovieClip("infoText",ploader.getNextHighestDepth());
  133. ploader.infoText.cacheAsBitmap = true;
  134. ploader.infoText._x = Stage.width-415;
  135. ploader.infoText._y = 95;
  136.  
  137. // Create Info Text
  138. var iT = ploader.infoText.createTextField("iT",ploader.infoText.getNextHighestDepth(),0,0,400,100);
  139. iT.text = "Now loading...";
  140. iT.selectable = false;
  141.  
  142. function setTextFormat2(textObject) {
  143. var format:TextFormat = new TextFormat();
  144. format.size = 18;
  145. format.letterSpacing = 3;
  146. format.font = "Segoe UI Light";
  147. format.color = 0xFFFFFF;
  148. format.align = "right";
  149. textObject.setTextFormat(format);
  150. }
  151. setTextFormat2(iT);
  152.  
  153. // Create Info Text Mask
  154. ploader.createEmptyMovieClip("iTM",ploader.getNextHighestDepth());
  155. ploader.iTM.cacheAsBitmap = true;
  156. ploader.iTM._x = Stage.width-400;
  157. ploader.iTM._y = 90;
  158.  
  159. // Draw Gradient in Info Text Mask
  160. with(ploader.iTM) {
  161. fillType = "linear";
  162. colors = [0x000000, 0x000000, 0x000000, 0x000000];
  163. alphas = [0, 100, 100, 0];
  164. ratios = [0, 75, 185, 255];
  165. matrix = {matrixType:"box", x:0, y:0, w:200, h:50, r:-90/180*Math.PI};
  166. lineStyle(1, 0x000000, 0);
  167. beginGradientFill(fillType, colors, alphas, ratios, matrix);
  168. moveTo(0, 0);
  169. lineTo(400, 0);
  170. lineTo(400, 50);
  171. lineTo(0, 50);
  172. lineTo(0, 0);
  173. endFill();
  174. }
  175.  
  176. function assignMasks() {
  177.  
  178. // Assign info text Mask
  179. ploader.infoText.setMask(ploader.iTM);
  180.  
  181. // Assign text Mask
  182. ploader.tcont.setMask(ploader.tmask);
  183.  
  184. // Assign Lines Mask
  185. ploader.lines.setMask(ploader.linesMask);
  186.  
  187. }
  188. assignMasks();
  189.  
  190. function easeInQuad(t, b, c, d) {
  191. return c*(t /= d)*t+b;
  192. }
  193.  
  194. function preload(){
  195. var loaded = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100);
  196. ploader.tcont.T.text = loaded;
  197. setTextFormat(ploader.tcont.T);
  198. if(loaded == 100){
  199. var startPos = ploader.infoText._y;
  200. var timeCount = 0;
  201. ploader.infoText.onEnterFrame = function() {
  202. //this._y = 65 - ( 65 - this._y ) / 1.1;
  203. this._y = easeInQuad(timeCount++, startPos, -55, 10);
  204. if (timeCount >= 10)
  205. {
  206. delete this.onEnterFrame;
  207. isLoaded = true;
  208. this.iT.text = "Click anywhere to play!";
  209. setTextFormat2(this.iT);
  210. this._y = 120;
  211. this.onEnterFrame = function() {
  212. this._y = 93 - ( 93 - this._y ) / 1.1;
  213. if (this._y == 93) {
  214. delete this.onEnterFrame;
  215. }
  216. }
  217. }
  218. }
  219. clearInterval(Int);
  220. }
  221. }
  222. var isLoaded:Boolean = false;
  223. var Int:Number = setInterval(preload,100);
  224. function onMouseDown(){
  225. if(isLoaded){
  226. _root.play();
  227. unloadMovie(bgGrad);
  228. unloadMovie(lines);
  229. unloadMovie(linesMask);
  230. unloadMovie(tcont);
  231. unloadMovie(tmask);
  232. unloadMovie(infoText);
  233. unloadMovie(iT);
  234. unloadMovie(iTM);
  235. unloadMovie(ploader);
  236. unloadMovie(pre_bgmc);
  237. delete preload;
  238. delete easeInQuad;
  239. delete setTextFormat;
  240. delete setTextFormat2;
  241. delete blurData;
  242. delete isLoaded;
  243. delete Int;
  244. delete onMouseDown;
  245. }
  246. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement