Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.38 KB | None | 0 0
  1. import mx.transitions.Tween;
  2. import mx.transitions.easing.*;
  3. import flash.display.*;
  4.  
  5. var lastCategory = 0;
  6. var thisButt = 0;
  7.  
  8. var imgLoader:MovieClipLoader = new MovieClipLoader();
  9. var imgListener:Object = new Object();
  10. imgLoader.addListener(imgListener);
  11.  
  12. /////////////Load XML Data/////////////
  13. category = new XML();
  14. category.ignoreWhite = true;
  15. category.onLoad = function(success) {
  16. if (success) {
  17. xmlNode = this.firstChild;
  18. Title = [];
  19. _global.link = [];
  20. total = xmlNode.childNodes.length;
  21. for (var i = 0; i<total; i++) {
  22. Title[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  23. _global.link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  24. categories_holder.attachMovie("catgoriesItem","item"+i,i+999);
  25. categories_holder["item"+i].title_txt.text = Title[i];
  26. categories_holder["item"+i].id = i;
  27. categories_holder["item"+i].title_txt.autoSize = true;
  28. categories_holder["item"+i]._x = (categories_holder["item"+(i-1)]._x+categories_holder["item"+(i-1)].title_txt._width+10);
  29. categories_holder["item"+i].line_mc._x = (categories_holder["item"+i].title_txt._width+5);
  30. categories_holder["item"+[total-1]].line_mc._alpha = 0;
  31. categories_holder["item"+i]._y = 0;
  32. block_mc._width = categories_holder._width-5;
  33. right_mc._x = block_mc._width+25;
  34. categories_holder["item"+thisButt].title_txt._alpha = 50;
  35. categories_holder["item"+thisButt].button_bttn.enabled = false;
  36. categories_holder["item"+i].button_bttn._width = categories_holder["item"+i].title_txt._width;
  37. categories_holder["item"+i].button_bttn.onRollOver = function() {
  38. categories_holder["item"+[this._parent.id]].title_txt._alpha = 50;
  39. };
  40. categories_holder["item"+i].button_bttn.onRollOut = function() {
  41. categories_holder["item"+[this._parent.id]].title_txt._alpha = 100;
  42. };
  43. categories_holder["item"+i].button_bttn.onRelease = function() {
  44. scrollBttn._y = 33;
  45. holder_mc._y = 34;
  46. for (var i = 0; i<total; i++) {
  47. removeMovieClip(holder_mc["butj"+i]);
  48. }
  49. images.load(_global.link[this._parent.id]);
  50. lastCategory = this.id;
  51. categories_holder["item"+thisButt].title_txt._alpha = 100;
  52. categories_holder["item"+thisButt].button_bttn.enabled = true;
  53. thisButt = this._parent.id;
  54. categories_holder["item"+thisButt].title_txt._alpha = 50;
  55. categories_holder["item"+thisButt].button_bttn.enabled = false;
  56. };
  57. images.load(_global.link[0]);
  58. }
  59. }
  60. };
  61. category.load("Gallery/galleries.xml");
  62.  
  63.  
  64. /////////////Load Category Data/////////////
  65. images = new XML();
  66. images.ignoreWhite = true;
  67. images.onLoad = function(success) {
  68. if (success) {
  69. xmlNode = this.firstChild;
  70. image = [];
  71. thumb = [];
  72. _global.desc = [];
  73. total = xmlNode.childNodes.length;
  74. for (var i = 0; i<total; i++) {
  75. image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  76. thumb[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  77. _global.desc[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
  78. holder_mc.attachMovie("thumb","butj"+i,i+999);
  79. holder_mc["butj"+i].thumb_mc._alpha = 0;
  80. holder_mc["butj"+i].id = i;
  81. holder_mc["butj"+i]._x = i%4*140+25;
  82. holder_mc["butj"+i]._y = Math.floor(i/4)*90;
  83. holder_mc["butj"+i].thumb_mc.loadMovie(thumb[i],1);
  84. MoveNav = new Tween(holder_mc["butj"+i].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+i].thumb_mc._alpha, 100, 1, true);
  85. holder_mc["butj"+i].onRollOver = function() {
  86. MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 50, 0.5, true);
  87. };
  88. holder_mc["butj"+i].onRollOut = function() {
  89. MoveNav = new Tween(holder_mc["butj"+[this.id]].thumb_mc, "_alpha", Strong.easeOut, holder_mc["butj"+[this.id]].thumb_mc._alpha, 100, 3, true);
  90. };
  91. holder_mc["butj"+i].onRelease = function() {
  92. _parent._parent.gallery = 1;
  93. _global.desc[z] = _global.desc[this.id];
  94. _parent._parent.big_symbol._width = Stage.width;
  95. _parent._parent.big_symbol._height = Stage.height;
  96. _parent._parent.big_symbol._x = 0;
  97. _parent._parent.big_symbol._y = 0;
  98. _parent._parent.big_symbol._visible = true;
  99. MoveNav = new Tween(_parent._parent.big_symbol, "_alpha", Strong.easeOut, _parent._parent.big_symbol._alpha, 90, 2, true);
  100. _parent._parent.description_mc.img_holder.createEmptyMovieClip("myMC",getNextHighestDepth());
  101. loadBitmapSmoothed(image[this.id], _parent._parent.description_mc.img_holder.myMC);
  102. //imgLoader.loadClip(image[this.id],_parent._parent.description_mc.img_holder);
  103. _parent._parent.loader_mc._visible = true;
  104. _parent._parent.loader_mc.gotoAndPlay(2);
  105. };
  106. }
  107. }
  108. };
  109.  
  110. function loadBitmapSmoothed(url:String, target:MovieClip) {
  111. // Create a movie clip which will contain our
  112. // unsmoothed bitmap
  113. var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth());
  114. // Create a listener which will notify us when
  115. // the bitmap loaded successfully
  116. var listener:Object = new Object();
  117. // Track the target
  118. listener.tmc = target;
  119. // If the bitmap loaded successfully we redraw the
  120. // movie into a BitmapData object and then attach
  121. // that BitmapData to the target movie clip with
  122. // the smoothing flag turned on.
  123. listener.onLoadInit = function(mc:MovieClip) {
  124. mc._visible = false;
  125. var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
  126. this.tmc.attachBitmap(bitmap,this.tmc.getNextHighestDepth(),"auto",true);
  127. bitmap.draw(mc);
  128. pictureSizeHolder();
  129. };
  130. // Do it, load the bitmap now
  131. var loader:MovieClipLoader = new MovieClipLoader();
  132. loader.addListener(listener);
  133. loader.loadClip(url,bmc);
  134. }
  135.  
  136. pictureSizeHolder = function () {
  137. if ((_parent._parent.description_mc.img_holder._height>Stage.height-250) or (_parent._parent.description_mc.img_holder._width>Stage.width-250)) {
  138. pictureSizeHolderBig();
  139. } else {
  140. pictureSizeHolderSmall();
  141. }
  142. };
  143.  
  144. pictureSizeHolderBig = function () {
  145. _parent._parent.description_mc.img_holder._height = Stage.height-250;
  146. _parent._parent.description_mc.img_holder._width = Stage.width-250;
  147. _parent._parent.description_mc.img_holder._yscale>_parent._parent.description_mc.img_holder._xscale ? _parent._parent.description_mc.img_holder._yscale=_parent._parent.description_mc.img_holder._xscale : _parent._parent.description_mc.img_holder._xscale=_parent._parent.description_mc.img_holder._yscale;
  148. _parent._parent.description_mc.img_holder._y = -(_parent._parent.description_mc.img_holder._height+40);
  149. _parent._parent.description_mc.img_holder._x = 0;
  150. _parent._parent.description_mc.block_mc.black_mc._width = _parent._parent.description_mc.img_holder._width;
  151. _parent._parent.description_mc.white_mc._width = _parent._parent.description_mc.img_holder._width+20;
  152. _parent._parent.description_mc.white_mc._height = _parent._parent.description_mc.img_holder._height+60;
  153. _parent._parent.description_mc.mask_mc._width = _parent._parent.description_mc.img_holder._width-33;
  154. _parent._parent.description_mc.white_mc._x = -10;
  155. _parent._parent.description_mc.white_mc._y = _parent._parent.description_mc.img_holder._y-10;
  156. _parent._parent.description_mc.text_txt.htmlText = _global.desc[z];
  157. _parent._parent.description_mc.text_txt.autoSize = true;
  158. _parent._parent.description_mc.text_txt.textWidth = _parent._parent.description_mc.mask_mc._width;
  159. if (_parent._parent.description_mc.text_txt.textHeight>35.5) {
  160. _parent._parent.description_mc.text_txt._y = -36.5;
  161. } else {
  162. _parent._parent.description_mc.text_txt._y = -28.5;
  163. }
  164. _parent._parent.description_mc._x = Stage.width/2-_parent._parent.description_mc._width/2;
  165. _parent._parent.description_mc._y = -_parent._parent.description_mc._height;
  166. MoveNav = new Tween(_parent._parent.description_mc, "_y", Strong.easeOut, _parent._parent.description_mc._y, Stage.height/2+_parent._parent.description_mc._height/2, 1, true);
  167. };
  168.  
  169. pictureSizeHolderSmall = function () {
  170. _parent._parent.description_mc.img_holder._y = -(_parent._parent.description_mc.img_holder._height+40);
  171. _parent._parent.description_mc.img_holder._x = 0;
  172. _parent._parent.description_mc.block_mc.black_mc._width = _parent._parent.description_mc.img_holder._width;
  173. _parent._parent.description_mc.white_mc._width = _parent._parent.description_mc.img_holder._width+20;
  174. _parent._parent.description_mc.white_mc._height = _parent._parent.description_mc.img_holder._height+60;
  175. _parent._parent.description_mc.mask_mc._width = _parent._parent.description_mc.img_holder._width-33;
  176. _parent._parent.description_mc.white_mc._x = -10;
  177. _parent._parent.description_mc.white_mc._y = _parent._parent.description_mc.img_holder._y-10;
  178. _parent._parent.description_mc.text_txt.htmlText = _global.desc[z];
  179. _parent._parent.description_mc.text_txt.autoSize = true;
  180. _parent._parent.description_mc.text_txt.textWidth = _parent._parent.description_mc.mask_mc._width;
  181. if (_parent._parent.description_mc.text_txt.textHeight>35.5) {
  182. _parent._parent.description_mc.text_txt._y = -36.5;
  183. } else {
  184. _parent._parent.description_mc.text_txt._y = -28.5;
  185. }
  186. _parent._parent.description_mc._x = Stage.width/2-_parent._parent.description_mc.img_holder._width/2-10;
  187. _parent._parent.description_mc._y = -_parent._parent.description_mc._height;
  188. MoveNav = new Tween(_parent._parent.description_mc, "_y", Strong.easeOut, _parent._parent.description_mc._y, Stage.height/2+_parent._parent.description_mc._height/2, 1, true);
  189. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement