Adobe Systems, Inc.

CollectionClip.as

Go to the documentation of this file.
00001 /****************************************
00002 ** Copyright 2005-2006 Adobe Systems Incorporated
00003 ** Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004 ** or a copy at http://opensource.adobe.com/licenses.html)
00005 **
00006 ** CollectionClip Class 
00007 ****************************************/
00008 import amg.*;
00009 
00010 class amg.CollectionClip extends MovieClip { 
00011         private var _strCollectionName:String;  
00012         private var _strCollectionTitle:String; 
00013         private var _strThumbUrl:String;
00014         private var _strDescription:String;
00015         private var _strNumImages:String;
00016         private var _jpegLoader:MovieClipLoader;
00017         private var mcCollectionThumb:MovieClip;                //name of the container movieclip for thumbs in directory.fla
00018         private var txtTitle:TextField;
00019         private var txtDescription:TextField;
00020         private var txtNumImages:TextField;
00021         private var mcCollectionClipOver:MovieClip;
00022         private var _mcThumbBorderBottom:MovieClip;
00023         private var _mcThumbBorderRight:MovieClip;
00024         private var _mcThumbBorderCapTop:MovieClip;
00025         private var _mcThumbBorderCapL:MovieClip;
00026         private var _mcThumbBorderCapR:MovieClip;
00027         
00028         //class constructor
00029         public function CollectionClip(){
00030                 //set mouse event functions
00031                 this.onPress = thumbClick;
00032                 this.onRollOver = overThumb;
00033                 this.onRollOut = offThumb;
00034                 
00035                 //create and set listener for jpeg loading
00036                 this._jpegLoader = new MovieClipLoader();
00037                 _jpegLoader.addListener(this);
00038                 
00039         }
00040         
00041         public function initClip(collname:String,colltitle:String,url:String,desc:String,numImg:String){
00042                 this._strCollectionName = collname;
00043                 this._strCollectionTitle = colltitle;
00044                 this._strThumbUrl = url;
00045                 this._strDescription = desc;
00046                 this._strNumImages = numImg;
00047                 //load thumbnail
00048                 this._jpegLoader.loadClip(this._strThumbUrl,this.mcCollectionThumb);
00049                 
00050         }
00051         
00052         public function onLoadInit (target:MovieClip):Void{
00053                 
00054                 this.txtTitle.text = this._strCollectionTitle;
00055                 this.txtDescription.text = this._strDescription;
00056                 this.txtNumImages.text = "(" + this._strNumImages + " Images)";
00057                 
00058                 
00059                 //draw white border around thumb
00060                 this.beginFill(0xFFFFFF);
00061                 this.moveTo(this.mcCollectionThumb._x-3,this.mcCollectionThumb._y-3);
00062                 this.lineTo(this.mcCollectionThumb._width+this.mcCollectionThumb._x+3,this.mcCollectionThumb._y-3);
00063                 this.lineTo(this.mcCollectionThumb._width+this.mcCollectionThumb._x+3,this.mcCollectionThumb._height+this.mcCollectionThumb._y+3);
00064                 this.lineTo(this.mcCollectionThumb._x-3,this.mcCollectionThumb._height+this.mcCollectionThumb._y+3);
00065                 this.lineTo(this.mcCollectionThumb._x-3,this.mcCollectionThumb._y-3);
00066                 this.endFill();
00067                 
00068                 //init drop shadow movie clips
00069                 this._mcThumbBorderCapTop = this.attachMovie("mcThumbBorderCapTop","topcap",10);
00070                 this._mcThumbBorderRight = this.attachMovie("mcThumbBorderRight","right_border",9);
00071                 this._mcThumbBorderBottom = this.attachMovie("mcThumbBorderBottom","bot_border",8);
00072                 this._mcThumbBorderCapL = this.attachMovie("mcThumbBorderCapL","leftcap",7);
00073                 this._mcThumbBorderCapR = this.attachMovie("mcThumbBorderCapR","rightcap",6);
00074                 
00075                 //set right dropshadow for thumb
00076                 this._mcThumbBorderCapTop._x = this._mcThumbBorderRight._x = this.mcCollectionThumb._width+this.mcCollectionThumb._x+3;
00077                 this._mcThumbBorderCapTop._y = this.mcCollectionThumb._y - 3;
00078                 this._mcThumbBorderRight._y = this.mcCollectionThumb._y + 1;
00079                 this._mcThumbBorderRight._height = this.mcCollectionThumb._height+2;
00080                 
00081                 //set bottom dropshadow for thumb
00082                 this._mcThumbBorderBottom._y = this._mcThumbBorderCapL._y = this._mcThumbBorderCapR._y = this.mcCollectionThumb._height+this.mcCollectionThumb._y+3;
00083                 this._mcThumbBorderBottom._x = this.mcCollectionThumb._x+1;
00084                 this._mcThumbBorderBottom._width = this.mcCollectionThumb._width+2;
00085                 this._mcThumbBorderCapR._x = this.mcCollectionThumb._width+this.mcCollectionThumb._x+3;
00086                 this._mcThumbBorderCapL._x = this.mcCollectionThumb._x-3;
00087         }
00088         
00089         //function called when thumbnail is clicked
00090         private function thumbClick(){
00091                 getURL(this._strCollectionName+"_gal.html", "_self");
00092         }
00093         //function called when mouse is over thumbnail
00094         private function overThumb(){
00095                 this.mcCollectionClipOver._visible = true;
00096         }
00097         //function called when mouse rolls off of thumbnail
00098         private function offThumb(){
00099                 this.mcCollectionClipOver._visible = false;
00100         }
00101         
00102 
00103 
00104 }

Copyright © 2006 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.