We Recommend

The Definitive Guide to Django The Definitive Guide to Django
In The Definitive Guide to Django: Web Development Done Right, Adrian Holovaty, one of Django’s creators, and Django lead developer Jacob Kaplan–Moss show you how they use this framework to create award–winning web sites.


Posted By

sk8rjess on 03/17/08


Tagged


Versions (?)


menu


Published in: ActionScript 


  1. import mx.transitions.Tween;
  2. import mx.transitions.easing.*;
  3.  
  4. var myGalleryXML = new XML();
  5. myGalleryXML.ignoreWhite = true;
  6. myGalleryXML.load("aboutus.xml");
  7.  
  8. myGalleryXML.onLoad = function() {
  9. gallery_x = 830.0;
  10. gallery_y = 40;
  11. gallery_width = 150;
  12. gallery_height = 453;
  13.  
  14. myImages = myGalleryXML.firstChild.childNodes;
  15. names = myGalleryXML.firstChild.attributes;
  16. myImagesTotal = myImages.length;
  17.  
  18. thumb_height = 108;
  19. thumb_width = 150;
  20.  
  21.  
  22.  
  23. //full_x = myGalleryXML.firstChild.attributes.full_x;
  24. //full_y = myGalleryXML.firstChild.attributes.full_y;
  25.  
  26. callThumbs();
  27. createMask();
  28. scrolling();
  29.  
  30. };
  31.  
  32. function callThumbs() {
  33. createEmptyMovieClip("container_mc",z.getNextHighestDepth());
  34. container_mc._x = gallery_x;
  35. container_mc._y = gallery_y;
  36.  
  37. var clipLoader = new MovieClipLoader();
  38. var preloader1 = new Object();
  39. clipLoader.addListener(preloader1);
  40.  
  41. for (mn=0; mn<myImagesTotal; mn++) {
  42. thumbURL = myImages[mn].attributes.thumb_url;
  43. myThumb_mc = container_mc.createEmptyMovieClip(mn, container_mc.getNextHighestDepth());
  44. myThumb_mc = myThumb_mc.createEmptyMovieClip(mn, myThumb_mc.getNextHighestDepth());
  45. myThumb_mc._y = thumb_height*mn;
  46. myThumb_mc1 = container_mc.createEmptyMovieClip(mn, container_mc.getNextHighestDepth());
  47. myThumb_mc1._y = (thumb_height*mn)/2;
  48. myThumb_mc._xscale = 50;
  49. myThumb_mc._yscale = 50;
  50.  
  51. //myThumb_mc._yscale = 10;
  52. clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
  53. preloader1.onLoadStart = function(target) {
  54. target.createTextField("my_txt",target.getNextHighestDepth,0,0,100,20);
  55. target.my_txt.selectable = false;
  56. target.createTextField("theText",target.getNextHighestDepth,0,0,100,20);
  57. target.theText.selectable = false;
  58. };
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. preloader1.onLoadProgress = function(target, loadedBytes, totalBytes) {
  66. target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
  67. };
  68.  
  69. preloader1.onLoadInit = function(theText) {
  70. theText = theText._parent;
  71.  
  72. var mn = parseInt(theText._name);
  73. var txt = theText.createTextField("txt", theText.getNextHighestDepth(), 0, 0, 100, 20);
  74. txt.selectable = false;
  75. txt.antiAliasType = "advanced";
  76. txt.autoSize = true;
  77. txt.textColor = 0xFFFFFF;
  78. var myformat:TextFormat = new TextFormat();
  79. myformat.size = 22;
  80. myformat.font = "Papyrus";
  81. myformat.align = center;
  82. myformat.italic = true;
  83.  
  84. txt.text = myImages[mn].attributes.name.split(" ").join("\n");
  85. if ([myImages[mn].attributes.name == ("Aquatic")]){
  86. myImages[mn].attributes.name._x = (myThumb_mc1._width-txt._width)/5+80;
  87. };
  88.  
  89. //txt.text = myImages[i].attributes.name;
  90. txt.setTextFormat(myformat);
  91. /*txt._x = (myThumb_mc1._width-txt._width)/5+80;
  92. txt._y = (myThumb_mc1._height-txt._height)/5+90;*/
  93. txt._x = (theText._width-txt._width)/2;
  94. txt._y = (theText._height-txt._height)/2;
  95. var dShadow = new flash.filters.DropShadowFilter();
  96. var glow = new flash.filters.GlowFilter();
  97. dShadow.angle = 0;
  98. glow.color = 0xCCCCCC;
  99. txt.filters = [glow, dShadow];
  100. };
  101. preloader1.onLoadComplete = function(target) {
  102. new Tween(target, "_alpha", Strong.easeOut, 0, 50, .5, true);
  103. target.my_txt.removeTextField();
  104.  
  105.  
  106.  
  107.  
  108. target.onRelease = function() {
  109. gotoAndStop(this._name+"mc");
  110. };
  111.  
  112. target.onRollOver = function() {
  113. this._alpha = 200;
  114. target.txt._alpha = 0;
  115.  
  116.  
  117. };
  118.  
  119. target.onRollOut = function() {
  120. this._alpha = 50;
  121. target.txt._alpha = 100;
  122.  
  123.  
  124. };
  125.  
  126.  
  127.  
  128. };
  129. }
  130. }
  131.  
  132.  
  133.  
  134.  
  135.  
  136. function createMask() {
  137.  
  138. createEmptyMovieClip("mask_mc",1);
  139.  
  140. mask_mc._x = gallery_x;
  141. mask_mc._y = gallery_y;
  142. mask_mc.beginFill(0x000000,100);
  143. mask_mc.lineTo(gallery_width,0);
  144. mask_mc.lineTo(gallery_width,gallery_height);
  145. mask_mc.lineTo(0,gallery_height);
  146. mask_mc.lineTo(0,0);
  147.  
  148. container_mc.setMask(mask_mc);
  149.  
  150. }
  151.  
  152.  
  153. function scrolling() {
  154. container_mc.onEnterFrame = function(){
  155. if (mask_mc.hitTest(_xmouse, _ymouse)) {
  156. container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;
  157.  
  158. if (container_mc._y>mask_mc._y) {
  159. container_mc._y = mask_mc._y;
  160. }
  161.  
  162. if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
  163. container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
  164. }
  165.  
  166. }
  167. };
  168. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: xxneon on March 17, 2008

added support for the thumb text..

You need to login to post a comment.