Published in: ActionScript
import mx.transitions.Tween; import mx.transitions.easing.*; var myGalleryXML = new XML(); myGalleryXML.ignoreWhite = true; myGalleryXML.load("aboutus.xml"); myGalleryXML.onLoad = function() { gallery_x = 830.0; gallery_y = 40; gallery_width = 150; gallery_height = 453; myImages = myGalleryXML.firstChild.childNodes; names = myGalleryXML.firstChild.attributes; myImagesTotal = myImages.length; thumb_height = 108; thumb_width = 150; //full_x = myGalleryXML.firstChild.attributes.full_x; //full_y = myGalleryXML.firstChild.attributes.full_y; callThumbs(); createMask(); scrolling(); }; function callThumbs() { createEmptyMovieClip("container_mc",z.getNextHighestDepth()); container_mc._x = gallery_x; container_mc._y = gallery_y; var clipLoader = new MovieClipLoader(); var preloader1 = new Object(); clipLoader.addListener(preloader1); for (mn=0; mn<myImagesTotal; mn++) { thumbURL = myImages[mn].attributes.thumb_url; myThumb_mc = container_mc.createEmptyMovieClip(mn, container_mc.getNextHighestDepth()); myThumb_mc = myThumb_mc.createEmptyMovieClip(mn, myThumb_mc.getNextHighestDepth()); myThumb_mc._y = thumb_height*mn; myThumb_mc1 = container_mc.createEmptyMovieClip(mn, container_mc.getNextHighestDepth()); myThumb_mc1._y = (thumb_height*mn)/2; myThumb_mc._xscale = 50; myThumb_mc._yscale = 50; //myThumb_mc._yscale = 10; clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc); preloader1.onLoadStart = function(target) { target.createTextField("my_txt",target.getNextHighestDepth,0,0,100,20); target.my_txt.selectable = false; target.createTextField("theText",target.getNextHighestDepth,0,0,100,20); target.theText.selectable = false; }; preloader1.onLoadProgress = function(target, loadedBytes, totalBytes) { target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100); }; preloader1.onLoadInit = function(theText) { theText = theText._parent; var mn = parseInt(theText._name); var txt = theText.createTextField("txt", theText.getNextHighestDepth(), 0, 0, 100, 20); txt.selectable = false; txt.antiAliasType = "advanced"; txt.autoSize = true; txt.textColor = 0xFFFFFF; var myformat:TextFormat = new TextFormat(); myformat.size = 22; myformat.font = "Papyrus"; myformat.align = center; myformat.italic = true; txt.text = myImages[mn].attributes.name.split(" ").join("\n"); if ([myImages[mn].attributes.name == ("Aquatic")]){ myImages[mn].attributes.name._x = (myThumb_mc1._width-txt._width)/5+80; }; //txt.text = myImages[i].attributes.name; txt.setTextFormat(myformat); /*txt._x = (myThumb_mc1._width-txt._width)/5+80; txt._y = (myThumb_mc1._height-txt._height)/5+90;*/ txt._x = (theText._width-txt._width)/2; txt._y = (theText._height-txt._height)/2; var dShadow = new flash.filters.DropShadowFilter(); var glow = new flash.filters.GlowFilter(); dShadow.angle = 0; glow.color = 0xCCCCCC; txt.filters = [glow, dShadow]; }; preloader1.onLoadComplete = function(target) { new Tween(target, "_alpha", Strong.easeOut, 0, 50, .5, true); target.my_txt.removeTextField(); target.onRelease = function() { gotoAndStop(this._name+"mc"); }; target.onRollOver = function() { this._alpha = 200; target.txt._alpha = 0; }; target.onRollOut = function() { this._alpha = 50; target.txt._alpha = 100; }; }; } } function createMask() { createEmptyMovieClip("mask_mc",1); mask_mc._x = gallery_x; mask_mc._y = gallery_y; mask_mc.beginFill(0x000000,100); mask_mc.lineTo(gallery_width,0); mask_mc.lineTo(gallery_width,gallery_height); mask_mc.lineTo(0,gallery_height); mask_mc.lineTo(0,0); container_mc.setMask(mask_mc); } function scrolling() { container_mc.onEnterFrame = function(){ if (mask_mc.hitTest(_xmouse, _ymouse)) { container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15; if (container_mc._y>mask_mc._y) { container_mc._y = mask_mc._y; } if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) { container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height); } } }; }
Comments
Subscribe to comments
You need to login to post a comment.

added support for the thumb text..