PHP Libraries

by Kristoffe Brodeur.

All of this code works Flash CS3+ and AS2

arrayFunctions2


String.prototype.Replace=function(_old,_new)
     {
     while(this.indexOf(_old)>-1)
          {
          split1=this.split(_old);
          this=split1.join(_new);
          }
     return(this);
     }
//-----
Array.prototype.simpleClone=function(go)
     {
     if(!go)
          {
          trace("simpleclone");
          var a=new Array();
          for(var b in this){a[b]=this[b];}
          return(a);
          }
     }
Array.prototype.cloneAssocArray=function(go)
     {
     //
     if(!go)
          {
          //read [] from senocular
          var a=[];//[] means plain old Object
          //var a=new Object();
          for(var sub in this){a[sub]=this[sub];}
          return(a);
          }
     }
//-----
function clearArray(sentArray)
     {
     cCA=sentArray.length;
     for(bCA=0;bCA<cCA;bCA++)
          {
          sentArray.pop(0);
          trace(cCA.length);
          }
     }
//-----
function split_byAscii(sStr,sentAsciiCode)
     {
     //tF_debug.text="[ascii code]"+sentAsciiCode+sStr;
     divKey=String.fromCharCode(sentAsciiCode);
     currNode=-1;
     nodeStart=0;
     nodeEnd=0;
     nArray1=new Array();
     tChar="";
     //keep chr10 strip chr13 from code and use chr10 as the divKey
     //chr13 never loads from the internet
     //chr13 and then 10 come in as a pair from local files
     //either way local or remote, this will make the string work 100%
     if(sentAsciiCode==13)
          {
          tmpStr="";
          //
          for(a1=0;a1<sStr.length;a1++)
               {
               x1=sStr.substr(a1,1);
               //add the character as long as it isnt chr13
               //chr10 alone works 100% fine
               if(sStr.charCodeAt(a1)!=13)
                    {
                    tmpStr+=x1;
                    }
               }
          //now the divKey will just be chr10 alone
          sStr=tmpStr;
          divKey=chr(10);
          }
     //
     for(sa1=0;sa1<sStr.length;sa1++)
          {
          tChar=sStr.substr(sa1,1);
          //
          if(tChar==divKey)
               {
               nodeEnd=sa1-1;
               currNode++;
               nArray1[currNode]=sStr.substr(nodeStart,nodeEnd-nodeStart+1);
               nodeStart=sa1+1;                    
               }
          }

     return (nArray1);
     }

calcDayOfWeek_v2


//calcDayOfWeek V2.0 by Kristoffe Brodeur (c)2007 All Rights Reserved.
//
//calc_dayOfWeek          cDay,cMonth,cYear
//calc_daysPerMonth          sentYear
//07-06-2007     changed calc_dayOfWeek making Day 0=monday 6=sunday
function calc_dayOfWeek(cDay,cMonth,cYear)
     {
     trace("calc_dayOfWeek>");     
     //referencing program must use monday as day 0
     //tmpD="monday,tuesday,wednesday,thursday,friday,saturday,sunday";
     //trace("d,m,y>"+cDay+","+cMonth+","+cYear);
     var d;
     var a;
     var y;
     var m;
     a=Math.floor((14-cMonth)/12);
     //trace("a:"+a);
     y=cYear-a;
     //trace("y:"+y);     
     //trace("cMonth:"+cMonth);
     m=cMonth+(12*a)-2;
     //trace("m:"+m);     
     //add 4th year cuont
     //subtract 100th year count
     //add 400th year count
     d=(cDay+y+Math.floor(y/4)-Math.floor(y/100)+Math.floor(y/400)+Math.floor((31*m)/12));
     //trace("d:"+d);     
     d=d%7;
     //trace("d%7:"+d);     
     return(d);
     }//f()
//----------
function calc_leapYear(sY)
     {
     leap=false;
     //trace(sY%4);
     if(sY%4==0)
          {
          leap=true;
          }
     //trace(sY%100);
     if(sY%100==0)
          {
          leap=false;
          }
     //trace(sY%400);
     if(sY%400==0)
          {
          leap=true;
          }
     return(leap);
     }
//----------
function calc_daysPerMonth(sentYear)
     {
     isLeap=calc_leapYear(sentYear);
     _dPM=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
     //
     if(isLeap==true)
          {
          _dPM[1]=29;
          }
     return(_dPM);
     }
//----------

clearArray


function clearArray(cA_sentArray)
     {
     var cA_k=cA_sentArray.length;
          //
          for(cA_i=0;cA_i<cA_k;cA_i++)
               {
               cA_sentArray.shift();
               }//
     }//

colorScheme


//
_global._cScheme=new Object();
_cScheme.dayC=new Array();
//
var tA=new Array(169,69,69);
var tB=new Array(130,70,70);
//     
//-----------------------------------------------------------------------
function cGradient(colA,colB,steps)
     {
     //colA and colB are RGB arrays
     //steps are the amount of gradient levels
     //colorArray will hold the new array of RGB colors in a stepped gradient 'steps' in length
     colorArray=new Array();
     //finding the difference between the colA and colB in [R][G][B] nodes
     //dividing that difference by the amount of desired steps
     var d0=colB[0]-colA[0];
     var d0=d0/steps;
     var d1=colB[1]-colA[1];
     var d1=d1/steps;
     var d2=colB[2]-colA[2];
     var d2=d2/steps;
     //     
     for(cA=0;cA<steps;cA++)
          {
          colorArray[cA]=new Object();
          colorArray[cA].rC=colA[0]+d0*cA;
          colorArray[cA].gC=colA[1]+d1*cA;
          colorArray[cA].bC=colA[2]+d2*cA;
          }//for(a)
     trace colorArray[cA];
     return colorArray[cA];
     }//f()
//------------------------------------------------------------------------
_cScheme.dayC=cGradient(tA,tB,7);

compareArray


//compareArray.as by Kristoffe Brodeur. (c)2007 All rights Reserved
//v2.0 seperate as, checking for recursive failures
//----------
cmpArray.prototype.matchNode=function(sentNode,sentArray){
     //tF_debug.text+=newline+"-----"+sentArray.length;
     match=-1;
     u1=-1;
     do{
          u1++;
          //tF_debug.text+=newline+"[u1:"+u1+"][l]"+sentNode+":[s]"+sentArray[u1];
          //
          if(sentNode==sentArray[u1]){
               match=u1;
               }
          }
          while(u1<sentArray.length-1&&match==-1);
          //tF_debug.text+=newline+"(match at)"+u1;
          return(match);
     }
//----------
cmpArray.prototype.linkToOrig=function(){
     //
     if(this.n1_ID==0){
          this.links0=this.shLink;
          this.links1=this.lgLink;
          }
     //
     else{
          this.links1=this.shLink;
          this.links0=this.lgLink;
          }
     //tF_debug.text+=newline+"[linkToOrig]";
     //tF_debug.text+=newline+"(links0)"+this.links0;
     //tF_debug.text+=newline+"(links1)"+this.links1;
     this.cmpAction();
     }
//----------
cmpArray.prototype.compareNodes=function(){
     //tF_debug.text+=newline+"[compareNodes][create linkedlist *.lgLink]";
     this.lgLink=new Array();
     this.shLink=new Array();
     //fill in initial linked list as 0;
     for(fN=0;fN<this.lgArr.length;fN++){
          this.lgLink[fN]=-1;
          //
          if(fN<this.shArr.length){
               this.shLink[fN]=-1;
               }
          }
     //
     for(i=0;i<this.lgArr.length;i++){
          //
          test1=this.matchNode(this.lgArr[i],this.shArr);
          //
          //tF_debug.text+="(test1)"+test1;
          this.lgLink[i]=test1;//fill in the results of comparing l[i]>s[*]
          //
          if(test1!=-1){//make the short link to the long link
               this.shLink[test1]=i;
               }
          }
     //tF_debug.text+=newline+"[long]"+this.lgLink;
     //tF_debug.text+=newline+"[short]"+this.shLink;
     this.linkToOrig();
     }
//----------
cmpArray.prototype.go=function(){
     //tF_debug.text+=newline+"[go]";
     this.compareNodes();
     }
//----------
cmpArray.prototype.findShortest=function(){
     this.shLen=-1;
     //
     if(this.n1.length<this.n2.length){
          this.shLen=this.n1.length;
          this.shArr=this.n1;
          this.lgArr=this.n2;
          this.n1_ID=0;
          this.n2_ID=1;
          }
     if(this.n1.length>this.n2.length){
          this.shLen=this.n2.length;
          this.shArr=this.n2;
          this.lgArr=this.n1;
          this.n1_ID=1;
          this.n2_ID=0;
          }
     if(this.n1.length==this.n2.length){
          this.shLen=this.n1.length;
          this.shArr=this.n1;
          this.lgArr=this.n2;
          this.n1_ID=0;
          this.n2_ID=1;
          }
     //tF_debug.text+=newline+("(shLen)"+this.shLen);
     //tF_debug.text+=newline+("(shArr)"+this.shArr);
     //tF_debug.text+=newline+("(lgArr)"+this.lgArr);
     }
//----------
function cmpArray(sN1,sN2){
     //tF_debug.text+=newline+"[cmpArray]"+sN1.length+":"+sN2.length;
     this.n1=sN1;
     this.n2=sN2;
     this.n1_ID;
     this.n2_ID;
     //
     //tF_debug.text+=newline+"[this.findShortest]";
     this.findShortest();
     }

copyObject


//Selective copyObject by Kristoffe Brodeur
//v1.0 09-24-2006
//----------
//sentObj is the object you want to copy in whole
//propertyArray is a string seperated by commas with the properties you want to copy only
//if propertyArray is not present, all properties will be copied
function objectCopy(sentObject,propertyArray)
     {
     tmpObj=new Object();
     //no propertyArray, all properties are copied
     if(!propertyArray)
          {
          trace("NO ARRAY! FULL OBJECT PROP COPY");
          for(var p in sentObject)
               {
               //trace(p);
               tmpObj[p]=sentObject[p];
               }
          }
     //propertyArray was sent, only selected properties in the string to array will be copied
     else
          {
          propArray=propertyArray.split(",");
          //
          for(var p in sentObject)
               {
               //trace("[p]"+p);
               //
               for(a2=0;a2<propArray.length;a2++)
                    {
                    //trace("[p]"+p+":[A]"+propArray[a2]);
                    //
                    if(p==propArray[a2])
                         {
                         tmpObj[p]=sentObject[p];                         
                         }
                    }
               }
          }
     return(tmpObj);
     }

createMovieClip2


//createMovieClip2.as v10.0 12-15-2008
//By Kristoffe Brodeur.
//03-2005
//07-2005
//09-2005
//03-28-2006
//05-25-2006 -zoom scale initialization to beg
//06-19-2006 TimerA
//07-08-2006 a=RGB2HEX_2("255:255:255")->a="0xFFFFFF"
//09-10-2006 alignClip for quick object alignment to a larger parent object's limits
//09-12-2006 colorMorph2 - now a string "11:209:100" can be sent as colorA and colorB / + Number(*) to change strings to Int/Float
//10-05-2006 MovieClip.prototype.loadMC : f*loadAction=...||filename(.swf|.jpg|.png)
//12-09-2006 fixed loadMC to COPY loadAction, not just point to it. Created an Object fnctClone, then a property loadAction by copying
//12-25-2006 added sentLevel to timerA OBJ
//12-28-2006 added oopPar so a movieclip can reference its object oriented target after loading for loadAction pointing etc
//03-10-2007 fixed p1 as pl in one instance. 1 and l look a lot alike
//03-27-2007 rebuilt loadMC with deepCopy property duplication. after loading, new MC has all of old MC's props and methods.
//06-09-2007 MovieClip.prototype.propScale (maxW,maxH) now the MC can resize itself
//08-19-2008 Added name+depth to createEM so the new empty clips wouldnt overwrite themselves because of exact same names on given root
//12-15-2008 Reviewed TimerA and made it not rely on a MC
//01-04-2008 draw_rect on a sent object and it's width and height, and of course color
//-----
function draw_rect(sObj,w,h,sColor,sAlpha,xOff,yOff)
     {
     trace(sObj+newline+w+":"+h+":("+sColor+"):"+sAlpha+":"+xOff+":"+yOff);
     //color 0xFFFFFF R G B
     //offsets are not neccessary to draw a rectangle
     if(xOff==undefined){xOff=0;};
     if(yOff==undefined){yOff=0;};
     if(sAlpha==undefined){sAlpha=100;};
     sObj.beginFill(sColor,sAlpha);
     sObj.moveTo(0+xOff,0+yOff);
     sObj.lineTo(0+xOff+w,0+yOff);
     sObj.lineTo(0+xOff+w,0+yOff+h);
     sObj.lineTo(0+xOff,0+yOff+h);
     sObj.lineTo(0+xOff,0+yOff);
     sObj.endFill();
     }
//----------
MovieClip.prototype.propScale=function(maxW,maxH)
     {
     this._xscale=100;
     this._yscale=100;
     origW=this._width;
     origH=this._height;
     //------------------------------------------------------------
     if((origH/maxH)>(origW/maxW))
          {
          this._height=maxH;
          this._width=(maxH/origH)*origW;
          }//if
     //------------------------------------------------------------
     if((origH/maxH)<(origW/maxW))
          {
          this._width=maxW;
          this._height=(maxW/origW)*origH;
          }//if          
     //------------------------------------------------------------
     if((origH/maxH)==(origW/maxW))
          {
          this._width=maxW;
          this._height=maxH;
          }//if     
     }
//----------
MovieClip.prototype.loadMC=function(filename)
     {
     //tF_debug.text+=newline+"loadMC("+filename+")";
     //first, use the parent of this MC and make a holder for all of the MC's properties and methods
     //when you load a movieclip, it all gets lost anyway, so this allows a transfer from temp back to loaded MC
     p1=this._parent;//_root
     n1=this._name;//mc_placer
     l1=n1+"_ldr";//mc_placer_ldr
     //loadMC main placer for all subclips.
     //each loading MC will have a temp method and property hold on this p1._lMCPar
     if(!p1._lMCPar)
          {
          p1.createEmptyMovieClip("_lMCPar",10000);
          //trace("[p1._lMCPar]"+p1._lMCPar);
          }     
     nxtD=p1._lMCPar.getNextHighestDepth();
     tmpObj=p1._lMCPar.createEmptyMovieClip("_ldr"+nxtD,nxtD);
     tmpObj.objCopy=new Object();
     //
     for(var p in this)
               {
               tmpObj.objCopy[p]=this[p];     
               }     
     tmpObj.ldr=new MovieClipLoader();
     tmpObj.ldr.pnt=tmpObj.objCopy;
     tmpObj.ldr.onLoadInit=function(mc)
          {
          //tF_debug.text+=newline+"LOADED!";
          //
          for(var p in this.pnt)
               {
               mc[p]=this.pnt[p];
               }
          mc.loadAction();
          }

     tmpObj.ldr.loadClip(filename,this);
     }
//----------
function alignClip(sentRoot,sentMC,sentAlignX,sentAlignY)
     {
     X1=sentRoot._x;
     X1W=sentRoot._width;
     X2=sentMC._width;
     Y1=sentRoot._y;
     Y1H=sentRoot._height;
     Y2=sentMC._height;
     //trace("[root]"+sentRoot+newline+"[MC]"+sentMC);
     //trace("[X1]"+X1+"[X1W]"+X1W+"[X2]"+X2+"<"+sentAlignX+">");
     //trace("[Y1]"+Y1+"[Y1H]"+Y1H+"[Y2]"+Y2+"<"+sentAlignY+">");
     if(sentAlignX=="left")
          {
          newX=X1;
          }
     if(sentAlignX=="center"||sentAlignX=="c")
          {
          //trace("CENTER!");
          newX=X1+(X1W-X2)/2;
          }
     //
     if(sentAlignX=="right"||sentAlignX=="r")
          {
          newX=X1+X1W-X2;
          }
     if(sentAlignY=="top"||sentAlignY=="t")
          {
          newY=Y1;
          }
     //
     if(sentAlignY=="center"||sentAlignY=="c")
          {
          newY=Y1+(Y1H-Y2)/2;
          }
     if(sentAlignY=="bottom"||sentAlignY=="b")
          {
          newY=Y1+Y1H-Y2;
          }
     sentMC._x=newX;
     sentMC._y=newY;
     }     
//----------
function TimerA(sentObj,sentDur,sentLevel)
     {
     //trace("timer"+sentObj+":"+sentDur+":"+sentLevel);
     //
     if(!sentLevel)
          {
          sentLevel=0;
          }
     this.time1=new createEM(sentObj,"_timer_",30000+sentLevel,0,0);
     tgt1=this.time1.inst;
     tgt1.frame=-1;
     tgt1.dur=sentDur;
     tgt1.par=this;
     tgt1.onEnterFrame=function()
          {
          this.frame++;
          //trace(this.frame);
          //
          if(this.frame==this.dur)
               {
               this.onEnterFrame=function(){};
               //trace("finished timer");
               this.par.timerAction();
               }
          }
     }
//-------------------------------------------------------------------------
function glowObj(mcObj,frameRate)
     {
     //-----
     mcObj.fadeInAction=function()
          {
          fadeOutClip(this,this.frameRate);
          }//f()
     //-----
     mcObj.fadeOutAction=function()
          {
          fadeInClip(this,this.frameRate);
          }//f()
     //-----
     fadeInClip(mcObj,frameRate);
     mcObj.frameRate=frameRate;
     }
//-------------------------------------------------------------------------
function moveClipTo(mcObj,toX,toY,totalFrames)
     {
     trace("moveClipTo");
     mcObj.beg_x=mcObj._x;
     mcObj.beg_y=mcObj._y;
     mcObj.end_x=toX;
     mcObj.end_y=toY;
     mcObj.tFrames=totalFrames;
     mcObj.currFrame=-1;
     mcObj.rate_x=(mcObj.end_x-mcobj.beg_x)/2;
     mcObj.rate_y=(mcObj.end_y-mcobj.beg_y)/2;
     mcObj.onEnterFrame=function()
          {
          this.currFrame+=1;
          //
          if(this.currFrame==this.tFrames)
               {
               this.moveToAction();
               }//if
          else
               {
               this._x+=this.rate_x;
               this._y+=this.rate_y;
               }//else
          }//f(onEnterFrame)
     }//f(moveClipTo)
//-------------------------------------------------------------------------
function zoomClip(mcObj,zoom_beg,zoom_end,zoom_amt)
     {
     mcObj._xscale=zoom_beg;
     mcObj._yscale=zoom_beg;
     mcObj.zBeg=zoom_beg;
     mcObj.zEnd=zoom_end;
     mcObj.zSpeed=zoom_amt;
     len=mcObj.zBeg-mcObj.zEnd;
     mcObj.div=len/mcObj.zSpeed;
     mcObj.divCnt=-1;
     mcObj.onEnterFrame=function()
          {
          this.divCnt+=1;
          //
          if(this.divCnt!=this.zSpeed)
               {
               this._xscale-=this.div;
               this._yscale=this._xscale;
               }//if
          //
          else
               {
               this.onEnterFrame=function(){};
               this.zoomAction();
               }//else
          }//f()
     }//f(zoomClip)
//-------------------------------------------------------------------------
function fadeInClip(mcObj,frameRate,sent_fadeTo)
     {
     //
     if(sent_fadeTo)
          {
          //trace("[fadeTo]"+sent_fadeTo);
          //
          if(sent_fadeTo==100)
               {
               sent_fadeTo=99;
               }
          mcObj.fadeTo=sent_fadeTo;
          mcObj.fRate=frameRate;
          }//if
     else
          {
          mcObj.fadeTo=99;
          }//else
     //
     mcObj.onEnterFrame=function()
          {
          //trace("[]"+this._alpha+":"+this.fadeTo);
          //
          if(this._alpha<this.fadeTo)
               {
               //
               if(this._alpha+this.fRate<=99)
                    {
                    //trace("[adding]");
                    this._alpha+=this.fRate;
                    }
               else
                    {
                    //trace("[alpha=99]");
                    this._alpha=99.9;
                    }
               }//if
          //
          else
               {
               this.onEnterFrame=function(){};
               this.fadeInAction();
               }//else
          }//f()
     }//f()
//-------------------------------------------------------------------------
function fadeOutClip(mcObj,frameRate,sent_fadeTo)
     {
     //trace("FADEOUT!");
     //
     if(sent_fadeTo)
          {
          mcObj.fadeTo=sent_fadeTo;
          }//if
     else
          {
          mcObj.fadeTo=0;
          }//else
     //
     mcObj.onEnterFrame=function()
          {
          //
          if(this._alpha>this.fadeTo)
               {
               this._alpha-=frameRate;
               }//if
          //
          else
               {
               this.onEnterFrame=function(){};
               this.fadeOutAction();
               }//else
          }//f()
     }//f()
//----------
function createMC(sPar,sLibName,newObj,sLayer,sX,sY,sRot,sWidth,sHeight,vis)
     {
     //trace("//----------");
     this.libName=sLibName;
     this.mcName=newObj;
     this.depth=sLayer;
     this.newObjName=newObj+sLayer;
     var newMC=sPar.attachMovie(sLibName,this.newObjName,sLayer);
     this.instance=this.inst=newMC;
     //trace("[createMC][inst]"+this.inst+":");
     //trace("[sParent]"+sPar);
     //trace("[sLibName]"+sLibName);
     //trace("[sLayer]"+sLayer);
     //trace("[newObj]"+this.newObjName);
     //
     if(sWidth>0)
          {
          this.inst._width=sWidth;     
          }//if
     //
     if(sHeight>0)
          {
          this.inst._height=sHeight;               
          }//if
     //
     if(vis==1)
          {
          this.inst._visible=false;
          }//if
     this.inst._x=sX;
     this.inst._y=sY;
     //newMC._rotation=sRot;
     //rotateObj(newMC,0);
     newMC._rotation=sRot;
     rotateObj(newMC,0);
     }//f()
//----------
createMC.prototype.resetScale=function()
     {
     this.instance._xscale=100;
     this.instance._yscale=100;
     }//f()
//----------
function rotateObj(sentObj)
     {
     sentObj.rotate=function(amt)
          {
          //% means modulo
          //12%5 means 12/5 rem 2
          //a=12%5=2
          realAngle=0;
          //
          if(this._rotation<0)
               {
               realAngle=360+this._rotation;
               }//f()
          else
               {
               realAngle=this._rotation;
               }//else
          newAngle=realAngle+amt;
          //
          if(newAngle>360||newAngle<360)
               {
               newAngle=newAngle%360;
               }//f()
          //trace(amt+":"+realAngle+":"+newAngle);
          //_rotation 0-180 is 0~180
          if(newAngle<180)
               {
               //do nothing
               }//if
          //_rotation 180-360 is -180~0
          if(newAngle>180)
               {
               newAngle=-(360-newAngle);
               }//if
          this._rotation=newAngle;
          }//f()          
     }//f()
//----------
function createEM(sParent,newObj,sDepth,sX,sY)
     {
     //remember to add sDepth to the new MC name or it will write the same object ontop of the next one coming in
     newEM=sParent.createEmptyMovieClip(newObj+sDepth,sDepth);
     this.instance=this.inst=newEM;
     //trace("[EM]"+this.inst);
     this.inst._x=sX;
     this.inst._y=sY;
     }//f()
//---------------------------------------------------------------------------
function colorCycle(mcObj,sentColors,sentAmt,sentRate)
     {
     //trace(sentColors);
     trace("[colorCycle]");
     mcObj.colorAmt=sentAmt;
     mcObj.cArray=sentColors;
     mcObj.fRate=sentRate;
     mcObj.cyclePos=-1;
     mcObj.cC_step=0;
     mcObj.cMorphAction=function()
          {
          this.cyclePos++;
          trace("[+1]------------------------"+this.cyclePos);
          //
          switch(true)
               {
               case this.cyclePos<this.cArray.length-1:
                    {
                    trace("[c]<len:"+this.cArray[this.cyclePos]+":"+this.cArray[this.cyclePos+1]);
                    colorMorph2(this,this.cArray[this.cyclePos],this.cArray[this.cyclePos+1],this.colorAmt,this.fRate);
                    break;
                    }//case
               case this.cyclePos==this.cArray.length-1||(this.cArray.length==2&&this.cyclePos==2):
                    {
                    trace("[c]==len:"+this.cArray[this.cyclePos]+":"+this.cArray[0]);
                    tPos=this.cyclePos;
                    this.cyclePos=-1;
                    colorMorph2(this,this.cArray[tPos],this.cArray[0],this.colorAmt,this.fRate);
                    break;
                    }//case
               }//switch
          }//f()
     mcObj.cMorphAction();
     }//f()
//-------------------------------------------------------------------------
function colorMorph2(mcObj,colorA,colorB,colorAmt,frameRate)
     {
     //colors can now be a string "11:43:200" for colorA and colorB
     //
     x1=colorA.split(":");
     mcObj.machine=new createEM(mcObj,"cM_machine",0,0);
     ptr=mcObj.machine.instance;
     a=colorA.split(":");
     b=colorB.split(":");
     ptr.colA=new Array();
     ptr.colB=new Array();
     //
     for(c=0;c<a.length;c++)
          {
          ptr.colA[c]=Number(a[c]);
          ptr.colB[c]=Number(b[c]);
          }
     ptr.cAmt=colorAmt;
     ptr.frameRate=frameRate;
     ptr.cStep=0;
     ptr.cMA=new Array(0,0,0);     
     ptr.onEnterFrame=function()
          {
          cFrac=0;
          //
          if(this.cStep<100)
               {
               this.cStep+=this.frameRate;
               cFrac=this.cStep/100;
               //
               for(g=0;g<3;g++)
                    {
                    //Number(*) changes a string to a Number Int of Float
                    diff=Number(this.colB[g])-Number(this.colA[g]);
                    scaled=diff*cFrac;
                    newTotal=Number(this.colA[g])+scaled;
                    this.cMA[g]=newTotal;
                    }//for(g)
               //trace(this.cMA);
               colorTint(this._parent,this.cMA,this.cAmt);
               }//if
          //
          else
               {
               this.onEnterFrame=function(){};
               this._parent.cMorphAction();
               }//else
          }//f()
     }//f()
//-------------------------------------------------------------------------
function colorMorph(mcObj,colorA,colorB,colorAmt,frameRate)
     {
     //trace("[cMorph] A:"+colorA+" B:"+colorB);
     //
     mcObj.machine=new createEM(mcObj,"cM_machine",0,0);
     ptr=mcObj.machine.instance;
     ptr.colA=colorA;
     ptr.colB=colorB;
     ptr.cAmt=colorAmt;
     ptr.cStep=0;
     ptr.cMA=new Array(0,0,0);     
     ptr.onEnterFrame=function()
          {
          //trace("cS:"+this.cStep);
          //
          if(this.cStep<100)
               {
               this.cStep+=frameRate;
               cFrac=this.cStep/100;
               //
               for(g=0;g<3;g++)
                    {
                    this.cMA[g]=this.colA[g]+((this.colB[g]-this.colA[g])*cFrac);
                    //trace("["+g+"]"+this.cMA[g]);
                    }//for(g)
               colorTint(this._parent,this.cMA,this.cAmt);
               }//if
          //
          else
               {
               this.onEnterFrame=function(){};
               this._parent.cMorphAction();
               }//else
          }//f()
     }//f()
//---------------------------------------------------------------------------
function colorTint2(sentObj,sentColorString,sentAmt)
     {
     //trace("sentObj:"+sentObj+":sentColorString>"+sentColorString+":sentAmt>"+sentAmt);
     tmpClr=sentColorString.split(":");
     //trace(tmpClr);
     newT=new Object();
     newT.ra=newT.ga=newT.ba=100-sentAmt;
     var cRatio=sentAmt/100;
     newT.rb=Number(tmpClr[0])*cRatio;
     newT.gb=Number(tmpClr[1])*cRatio;
     newT.bb=Number(tmpClr[2])*cRatio;
     //trace(newT.rb+":"+newT.gb+":"+newT.bb);     
     cObj=new Color(sentObj);
     cObj.setTransform(newT);
     //trace("colotTint2>finished!");
     }//f(colorTint)
//---------------------------------------------------------------------------
function colorTint(sentObj,sentColorArray,sentAmt)
     {
     newT=new Object();
     newT.ra=newT.ga=newT.ba=100-sentAmt;
     var cRatio=sentAmt/100;
     newT.rb=sentColorArray[0]*cRatio;
     newT.gb=sentColorArray[1]*cRatio;
     newT.bb=sentColorArray[2]*cRatio;
     cObj=new Color(sentObj);
     cObj.setTransform(newT);
     }//f(colorTint)
//---------------------------------------------------------------------------
function Colorize(sentObj,sentColorArray)
     {
     //*.rC *.gC *.bC in sentColotArray
     newC=new Color(sentObj);
     //trace(sentObj+":"+sentColorArray);
     //trace(RGB2HEX(sentColorArray));
     newC.setRGB(RGB2HEX(sentColorArray));
     }//f()
//----------
//a=RGB2HEX_2("100:112:35");->a=0x647023 string;
//----------
function RGB2HEX_2(sentString)
     {
     tmpHex="0x";
     tmpRGB=sentString.split(":");
     trace(tmpRGB);
     //
     for(rgb1=0;rgb1<3;rgb1++)
          {
          tmp1=parseInt(tmpRGB[rgb1]);
          tmp2=tmp1.toString(16);
          if(tmp2.length<2)
               {
               tmp2="0"+tmp2;
               }
          tmpHex+=tmp2;
          }
     return(tmpHex);
     }
//----------
function RGB2HEX(cObj)
     {
     //---------------------------------------------------------------------------
     if(cObj)
          {
          //sCArray is a RGB color array with 0-255
          //toString(16) creates a string version of hex 00~FF
          //---------------------------------------------------------------------------
          if(cObj.rC&&cObj.bC&&cObj.gC)
               {
               var tempHex=new Array(cObj.rC.toString(16),cObj.bC.toString(16),cObj.gC.toString(16));
               }//if
          //---------------------------------------------------------------------------
          if(cObj.length==3)
               {
               var tempHex=new Array();
               //
               for(tA=0;tA<3;tA++)
                    {
                    tempHex[tA]=cObj[tA].toString(16);
                    }//for(tA)
               }//if
          //trace("sent cObj"+cObj);
          //trace("tempHex:"+tempHex);
          var finalHex="";
          var realHex=0xFFFFFF;
          //---------------------------------------------------------------------------
          for(rgbA=0;rgbA<3;rgbA++)
               {
               //
               if(tempHex[rgbA].length<2)
                    {
                    //trace("smaller than 10:"+tempHex[rgbA]);
                    tempHex[rgbA]="0"+tempHex[rgbA];
                    }//if
               //trace("HEX:"+tempHex[rgbA]);
               finalHex=finalHex+tempHex[rgbA];
               finalHex=finalHex.toUpperCase();
               }//for(rgbA)
          //trace("finalHex:"+finalHex);
          realHex=parseInt(finalHex,16);
          return realHex;
          //trace(realHex);
          }//if()
     }//f()
//--------------------------------------------------------------------------------------------
function limitResize(sent_LimW,sent_LimH,orig_w,orig_h)
     {
     //------------------------------------------------------------
     if(!destProp)
          {
          destProp=new Object();
          }//if
     //------------------------------------------------------------
     if((orig_h/sent_LimH)>(orig_w/sent_LimW))
          {
          destProp.h=sent_LimH;
          destProp.w=(sent_LimH/orig_h)*orig_w;
          }//if
     //------------------------------------------------------------
     if((orig_h/sent_LimH)<(orig_w/sent_LimW))
          {
          destProp.w=sent_LimW;
          destProp.h=(sent_LimW/orig_w)*orig_h;
          }//if          
     //------------------------------------------------------------
     if((orig_h/sent_LimH)==(orig_w/sent_LimW))
          {
          destProp.w=sent_LimW;
          destProp.h=sent_LimH;
          }//if
     return(destProp);
     }//f(limitResize)
//--------------------------------------------------------------------------------------------
function alignMC(sentChild,sentTarget)
     {
     sentChild._x=sentTarget._x;
     sentChild._y=sentTarget._y;
     }//f(alignMC)

crypto


//crypto v2.0 by kristoffe brodeur. ©2009 All Rights Reeserved.
//03-25-2009 made crypto seperate from arrayFunctions.as to reduce function and class overhead
//-----
function crypto(sentString,oldChar,newChar)
     {
     var cryptoString="";
     var tChar="";
     //
     for(crA=0;crA<sentString.length;crA++)
          {
          tChar=sentString.charAt(crA);
          //
          if(tChar==oldChar)
               {
               cryptoString=cryptoString+newChar;
               }//if
          else
               {
               cryptoString=cryptoString+tChar;
               }
          }//for(crA)
     return cryptoString;
     }//f(crypto)
//-----
function encrypt(sentString,charList_old,charList_new)
     {
     trace("[encrypt]");
     //tF_debug.text+="[?]"+newline+sentString+newline+charList_old+newline+charList_new;
     tempString=sentString;
     //
     for(i=0;i<charList_old.length;i++)
          {
          tempString=crypto(tempString,charList_old.substr(i,1),charList_new.substr(i,1));
          }//for(i)
     trace(tempString);
     return(tempString);
     }//f()

deepClone5


//-----
//DeepClone5.as by Kristoffe Brodeur. ©2009 All Rights Reserved.
/*
02-09-2009
added _pnt options to objects in arrays or references that are just meant as pointers so it stops endless recursive loops.
if the program finds an object or associative array node with _pnt as an ending
or a parent with _pnt, it will only reference to it not copy
03-14-2009
added new functions [addBranch] and [pushCopy] for easier control with XML and branch copy control
03-27-200
built addBranch properly for node from one array to push to another's end
07-02-2009
something is really wrong with this class and im going to figure it out
07-08-2009
made the push dupNode work fine now. nice new function simpleCopy
*/
//-----
DeepClone.prototype.stackPop=function()
     {
     //trace("->stackPop");
     this._recurse++;
     len=this._stack.length;
     tgt=this._stack[len-1];
     //
     if(len>1)
          {
          //trace(" stack popped. checking previous item ["+(len-1)+"] in substack");
          this._stack.pop();
          this.flow="subStackPop";
          this.checkRecursion();
          }
     else
          {
          //trace(" stack empty! End of DeepClone. Copy Ready!");
          this.cloneAction();
          }
     }
//-----
DeepClone.prototype.subStackPop=function()
     {
     //trace("->subStackPop");
     this._recurse++;
     len=this._stack.length;
     tgt=this._stack[len-1];
     tgt._subStack.pop();
     len2=tgt._subStack.length;
     //
     if(len2>0)
          {
          this.oldTgt=tgt._subStack[len2-1]._oR;
          this.newTgt=tgt._subStack[len2-1]._nR;
          //trace(" substack popped. checking previous item ["+(len2-1)+"] in substack");
          this.flow="subStackChk";
          this.checkRecursion();
          }
     else
          {
          //trace(" substack empty. recursing to previous _stack node");
          this.flow="stackPop";
          this.checkRecursion();
          }
     }
//-----
DeepClone.prototype.subStackChk=function()
     {
     //trace("->subStackCheck");
     this._recurse++;
     tOf=typeof(this.oldTgt);
     //
     switch(tOf)
          {
          case("object"):
               //trace(" \____ss->object");
               len=this._stack.length;
               len2=this._stack[len-1]._subStack.length;
               tgt=this._stack[len-1]._subStack[len2-1]._nP;
               //
               if(tgt==false)
                    {
                    //trace(" \____real");
                    //not just an ojbect pointer
                    this.flow="stackAdd";
                    this.checkRecursion();
                    }
               else
                    {
                    //trace(" \____pointer*****");
                    //object pointer; do not follow branch
                    this.flow="subStackPop";
                    this.checkRecursion();
                    }
               break;     
          //
          case("function"):
               //trace(" \____ss->function");
               this.flow="subStackPop";
               this.checkRecursion();
               break;
          //
          case("number"):
               //trace(" \____ss->number");
               this.flow="subStackPop";
               this.checkRecursion();
               break;
          //
          case("string"):
               //trace(" \____ss->string");
               this.flow="subStackPop";
               this.checkRecursion();
               break;
          default:
               //trace(" \____subStackCheck error. object type:"+tOf);
               this.cloneAction();
               break;
          }
     }
//-----
DeepClone.prototype.stackAdd=function()
     {
     this._recurse++;
     len=this._stack.length;
     //trace("->stackAdd len("+len+")");
     //trace("--------------------");
     st=this._stack[len]=new Object();
     9
     ss=st._subStack=new Array();
     cnt=-1;
     //
     for(var r in this.oldTgt)
          {
          cnt++;
          ss[cnt]=new Object();
          ss[cnt]._oN=r;
          ss[cnt]._oR=this.oldTgt[r];
          ss[cnt]._nP=false;
          tOf=typeof(this.oldTgt[r]);
          //trace(" ["+r+"]("+this.oldTgt[r]+") | "+tOf);
          //trace(tOf);
          //
          switch(tOf)
               {
               //
               case("object"):
                    {
                    //
                    if(this.oldTgt[r].length==undefined)
                         {
                         //trace(" \____["+r+"]"+tOf);
                         nLen=r.length;
                         nEnd=r.substring(nLen-4);
                         len=nEnd.length;
                         //
                         if(nEnd=="_pnt")
                              {
                              //trace(" new Pointer["+r+"]"+this.newTgt[r]);
                              this.newTgt[r]=this.oldTgt[r];
                              ss[cnt]._nP=true;
                              }
                         else
                              {
                              this.newTgt[r]=new Object();
                              //trace(" new Object["+r+"]"+this.newTgt[r]);
                              }
                         }
                    else
                         {
                         this.newTgt[r]=new Array();
                         //trace(" new Array["+r+"]"+this.newTgt[r]);
                         }
                    //
                    break;
                    }
               case("string"):
                    this.newTgt[r]=new String(this.oldTgt[r]);
                    //trace(" new String["+r+"]"+this.newTgt[r]);
                    break;
               default:
                    //trace("undefined typeof ["+r+"]("+tOf+")");
                    break;
               }
          ss[cnt]._nR=this.newTgt[r];
          }
     ////trace("--------------------");
     //
     if(cnt==-1)
          {
          //trace("empty object. stackPop>");
          this.flow="stackPop";
          this.checkRecursion();
          }
     else
          {
          //trace("nodes["+cnt+"] subStackChk>");
          this.oldTgt=ss[cnt]._oR;
          this.newTgt=ss[cnt]._nR;
          this.flow="subStackChk";
          this.checkRecursion();
          }
     }
//-----
DeepClone.prototype.checkRecursion=function()
     {
     //trace("->check_recursion ["+this._recurse+"]"+this.flow);
     this._recurse++;
     //
     if(this._recurse>this._recurseLim)
          {
          this.tmr=setInterval(this,"tmr_done",100);
          }
     else
          {
          this[this.flow]();
          }
     }
//-----
DeepClone.prototype.simpleCopy=function(oldArray,newArray,newName,oldName)
     {
     this._recurse++;
     //trace("oldArray#["+oldArray.length+"]"+newline+"newArray#["+newArray.length+"]"+newline+"newName["+newName+"]oldName["+oldName+"]");
     //
     if(oldName==undefined)
          {
          oldName=newName;
          }
     tOf_sC=typeof(oldArray[oldName]);
     //trace(tOf_sC);
     //
     switch(tOf_sC)
          {
          //
          case("object"):
               //
               if(oldArray[oldName].length==undefined)
                    {
                    newArray[newName]=new Object();
                    }
               else
                    {
                    newArray[newName]=new Array();
                    }
          break;
          //
          case("number"):
          newArray[newName]=new Number(oldArray[oldName]);
          break;
          //
          case("string"):
          newArray[newName]=new String(oldArray[oldName]);
          break;
          //
          case("function"):
          newArray[newName]=new Function(oldArray[oldName]);
          break;
          }
     }
//-----
DeepClone.prototype.init_pushNode=function()
     {
     //
     tOf_old=typeof(this.oldTgt);
     tOf_new=typeof(this.newTgt);
     //
     if((tOf_old=="object")&&(this.oldTgt.length==undefined))
          {
          ////trace("oldTgt = object");
          }
     else
          {
          ////trace("oldTgt = array->len("+this.oldTgt.length+")");
          //
          if((tOf_new=="object")&&(this.newTgt.length!=undefined))
               {
               //trace("oldTgt = array && newTgt = array, continuing to (push) onto newTgt");
               ////trace("oldTgt#["+this.oldTgt.length+"]");
               len=this.newTgt.length;
               this.simpleCopy(this.oldTgt,this.newTgt,len,this.baseNode);
               ////trace("newTgt#["+this.newTgt.length+"]");
               this.newTgt=this.newTgt[len];
               this.oldTgt=this.oldTgt[this.baseNode];
               this.stackAdd();
               }
          else
               {
               //trace("error #0: both oldTgt and newTgt MUST be arrays, even the same array. newTgt is NOT an array type");
               }
          }
     }
//-----
DeepClone.prototype.dupNode=function(command,oldTgt,baseNode,newTgt,sClear)
     {
     //trace("->dupNode");
     this._recurse++;
     this._command=command;
     this.oldTgt=oldTgt;
     this.baseNode=baseNode;
     this.newTgt=newTgt;
     //
     switch(command)
          {
          case("push"):
               {
               this.init_pushNode();
               }
          }
     //
     }
//-----
function DeepClone()
     {
     //trace("DeepClone>-------------------------------------------------------------------");
     this._recurse=-1;
     this._recurseLim=96;
     this.flow="";
     this._stack=new Array();
     this.tmr_done=function()
          {
          clearInterval(this.tmr);
          this._recurse=-1;
          this[this.flow]();
          }
     }

DispTree


//DispTree v1.0
//©2009 by Kristoffe Brodeur. All Rights Reserved.
//-----
DispTree.prototype.checkRecursion=function()
     {
     this.recursion++;
     //
     if(this.recursion>this.recLimit)
          {
          this.tmr=setInterval(this,"tmrCall",60);
          //trace("DispTree pause");
          }
     else
          {
          //
          switch(this.loopPath)
               {
               //
               case("stackChk"):
                    this.stackChk();
                    break;
               //
               case("nest"):
                    this.nest();
                    break;
               //
               default:
                    break;
               }
          }
     }
//-----
DispTree.prototype.stackChk=function()
     {
     this.recursion++;
     //trace("stackChk>----");
     len=this.nodeStack.length;
     tgt=this.nodeStack[len-1];
     tgt.pos++;
     //trace("pos "+tgt.pos+" | cnt "+tgt.cnt);
     //
     if(tgt.pos<tgt.cnt)
          {
          //trace("++");
          this.AP=this.nodeStack[len-1].cn_pnt[tgt.pos];
          //trace("^"+this.AP);
          this.loopPath="nest";
          this.checkRecursion();
          }
     //
     else
          {
          //
          str2="";
          len2=tgt.strs.length;
          //
          for(v=0;v<len2;v++)
               {
               //trace(tgt.strs[v]);
               str2+=newline+tgt.strs[v];
               }
          tgt2=this.nodeStack[len-2];
          tgt2.strs[tgt2.pos]+=str2;          
          //
          if(len>1)
               {
               this.nodeStack.pop();
               this.loopPath="stackChk";
               this.checkRecursion();
               }
          //
          else
               {
               //trace("end.");
               //
               len3=tgt.strs.length;
               //
               for(v=0;v<len3;v++)
                    {
                    //trace(tgt.strs[v]);
                    this.output+=tgt.strs[v];
                    }
               this.dispAction();
               trace(this.output);
               this.outputTgt.text=this.output;
               }
          }
     }
//-----
DispTree.prototype.nest=function()
     {
     this.recursion++;
     //trace("nest>");
     len=this.nodeStack.length;
     tgt=this.nodeStack[len]=new Object();
     tgt.cn_pnt=new Array();
     tgt.strs=new Array();
     tgt.pos=-1;
     //
     tab="";
     for(v=0;v<len;v++)
          {
          tab+=" ";
          }
     loop=-1;
     //
     for(var r in this.AP)
          {
          loop++;
          str=tab+v+">"+loop+"["+r+"]("+this.AP[r]+")";
          tgt.strs[loop]=str;
          //trace("*"+str);
          chk=-1;
          //
          for(var r2 in this.AP[r])
               {
               //trace(" |_____"+r2+":"+this.AP[r][r2]);
               chk++;
               }
          //
          if(chk!=-1)
               {
               len_r=r.length;
               xx=r.substr(len_r-4,4);
               //
               if(xx!="_pnt")
                    {
                    tgt.cn_pnt[loop]=this.AP[r];
                    }
               }
          }
     tgt.cnt=this.nodeStack[len].cn_pnt.length;
     //trace("pos "+tgt.pos+" | cnt "+tgt.cnt);
     this.loopPath="stackChk";
     this.checkRecursion();
     }
//-----
function DispTree(sObj,sOutputTgt)
     {
     trace("----------------------------------------------------------");
     trace("DispTree");
     trace("----------------------------------------------------------");
     this.tmrCall=function()
          {
          clearInterval(this.tmr);
          this.recursion=0;
          this.checkRecursion();
          }
     this.output="";
     this.loopPath="";
     this.outputTgt=sOutputTgt;
     this.recursion=0;
     this.recLimit=128;
     this.nodeStack=new Array();
     this.AP=sObj;
     this.nest();
     }

ease5


/*
ease5.as ©2009 by Kristoffe Brodeur. All Rights Reserved.
requires easeFormulas.as to function.
#include "./easeFormulas.as" in your code where ./ is the relative path to the file ../ ../../ etc
03-24-2009     complete redo of track system holding ease tracks
03-31-2009     fixed delete bug before easeAction call
04-01-2009     fixed onEnterframe=function(){}; bug where after all tracks were cut off nothing would work
               when later called because onEnterFrame wasn't undefined and was simply f(){};
04-07-2009 added # for a number to use with *.useNum(sNum) and prototype *.go() for ready and waiting eases triggered by *.go();
08-11-2009 fixed the possible contflict with 'tgt' as a variable in this function(class) by using '__tgt' and maybe 'tgt' externally
*/
function easeVal(eType,eCF,eTD,eTF,eX1)
     {
     eVal=0;
     //
     switch(eType)
          {
          case ("linear"):
               eVal=easeLinear(eCF,eTD,eTF);
               break;
          case ("inBack"):
               eVal=easeInBack(eCF,eTD,eTF,eX1);//overshoot is 4th variable
               break;
          case ("outBack"):
               eVal=easeOutBack(eCF,eTD,eTF,eX1);//overshoot is 4th variable
               break;
          case ("inQuad"):
               eVal=easeInQuad();
               break;
          case ("outQuad"):
               eVal=easeOutQuad();
               break;
          case ("inoutQuad"):
               eVal=easeInOutQuad();
               break;
          case ("inElastic"):
               eVal=easeInElastic();
               break;
          case ("outElastic"):
               eVal=easeOutElastic();
               break;
          case ("inBounce"):
               eVal=easeInBounce(eCF,eTD,eTF);
               break;
          case ("outBounce"):
               eVal=easeOutBounce(eCF,eTD,eTF);
               break;
          }
     //
     return eVal;     
     }
//-----
ease.prototype.go=function()
     {
     //trace("GO!"+this._track);
     this.mc_tracks.easeArr[this._track]._go=true;
     }
//-----
function ease(sMC,sTrack,sType,sStagger,sGo,sStart,sDist,sFrames,sX1)
     {
     //trace("ease> sMC:"+sMC);
     this._track=sTrack;
     this._mc=sMC;
     //trace("eTracks:"+sMC.eTracksMC);
     //     
     if(sMC.eTracksMC.valid!=true)
          {
          __tgt=sMC.eTracksMC=sMC.createEmptyMovieClip("eTracksMC1",10000);
          this.mc_tracks=__tgt;
          __tgt.valid=true;
          __tgt.easeArr=new Object();
          __tgt.tgt_mc=sMC;
          //-----
          __tgt.updateTracks=function()
               {
               this.cnt=0;
               //
               for(var idx in this.easeArr)
                    {
                    this.cnt++;
                    tgt=this.easeArr[idx];
                    //
                    if(tgt._go==true)
                         {
                         tgt._cFrame++;
                         //
                         if(tgt._cFrame<tgt._frames+1)
                              {
                              //-----
                              val=easeVal(tgt._type,tgt._cFrame,tgt._dist,tgt._frames,tgt._sX1);
                              //trace(idx);
                              //
                              if(idx!="#")
                                   {
                                   this.tgt_mc[tgt._track]=tgt._start+val;
                                   }
                              //
                              else
                                   {
                                   this.easeArr[idx]._par_pnt.useNum(tgt._start+val);
                                   }
                              //
                              if(tgt._cFrame==tgt._stagger)
                                   {
                                   tgt._par_pnt.staggerAction();
                                   }
                              }
                         //
                         else
                              {
                              //delete tgt; doesn't delete what tgt points to! use delete this.easeArr[idx];
                              x=tgt._par_pnt.easeAction;//reference with var x what function to call
                              //
                              if(idx=="#")
                                   {
                                   this._par_pnt.useNum=function(){};
                                   }
                              delete this.easeArr[idx];//don't delete tgt, because it is only a reference and this.easeArr[idx] will still exist
                              //
                              if(x!=undefined)
                                   {
                                   x();//add () to call the referenced function AFTER deleting the array item above so it won't exist in the loop
                                   }
                              }
                         }
                    }
               //
               if(this.cnt==0){this.onEnterFrame=function(){};}
               }
          }
     x=sMC.eTracksMC.easeArr;
     tgtTr=x[sTrack]=new Object();
     tgtTr._cFrame=-1;
     tgtTr._dist=sDist;
     tgtTr._frames=sFrames;
     tgtTr._go=sGo;
     tgtTr._par_pnt=this;
     tgtTr._stagger=sStagger;
     tgtTr._sX1=sX1;
     tgtTr._start=sStart;
     tgtTr._track=sTrack;
     tgtTr._type=sType;
     //
     sMC.eTracksMC.onEnterFrame=function()
          {
          //trace("*");
          this.updateTracks();
          }
     }

easeFormulas


//easeFormulas.as
//by Kristoffe Brodeur 06-26-2006
//formulas referenced by Robert Penner
//----------
function easeLinear(t,c,d)
     {
     a2=(c/d)*t;
     return a2;
     }//f(easeLinear)
//----------
function easeInBack(t,c,d,s)
     {
     if(s==undefined){s=1.70158;}//if
     //default s=1.70158=10% overshoot in radiians
     //s=0 no overshoot     
     t=t/d;
     a2=c*t*t*((s+1)*t-s);
     return a2;
     }//f(easeInBack)
//----------
function easeOutBack(t,c,d,s)
     {
     if(s==undefined){s=1.70158;}//if
     t=t/d-1;
     a2=c*(t*t*((s+1)*t+s)+1);     
     return a2;
     }//f(easeOutBack)
//----------
function easeInQuad(t,c,d)
     {
     t=t/d;
     a2=c*t*t;
     return a2;
     }//f(easeInQuad)
//----------
function easeOutQuad(t,c,d)
     {
     t=t/d;
     a2=-c*t*(t-2);
     return a2;
     }//f(easeOutQuad)
//----------
function easeInOutQuad(t,c,d)
     {
     t=t/(d/2);
     if(t<1){a2=c/2*t*t;return a2;}//if
     else{a2=-c/2*((--t)*(t-2)- 1);return a2;}//else
     }//f(easeInOutQuad)
//----------
function easeInElastic(t,c,d,a,p)
     {
     //from penner if t==0, he has b as the base of your animation start
     //i dont use it in the formula, so i return 0, as there is NO b in my formulas
     //a2=0 would have been a2=b
     //return c would have been return b+c
     //if [p]period is 0, nothing really happens
     if(t==0){a2=0;return a2;}//if
     t=t/d;
     if(t==1){a2=c;return a2;}//if
     if(!p){p=d*.3;}//if
     if(a<Math.abs(c)){a=c;s=p/4;}//if
     else{s=p/(2*Math.PI)*Math.asin(c/a);}//else
     t--;
     a2=-(a*Math.pow(2,10*t)*Math.sin((t*d-s)*(2*Math.PI)/p));
     return a2;
     }//f(easeInElastic)
//----------
function easeOutElastic(t,c,d,a,p)
     {
     if(t==0){a2=0;return a2;}//if
     t=t/d;
     if(t==1){a2=c;return a2;}//if
     if(!p){p=d*.3;}//if
     if(a<Math.abs(c)){a=c;s=p/4;}//if
     else{s=p/(2*Math.PI)*Math.asin(c/a);}//else
     a2=a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c;     
     return a2;
     }//f(easeOutElastic)
//----------
function easeInBounce(t,c,d)
     {
     a2=c-easeOutBounce(d-t,c,d);
     return a2;
     }//f(easeInBounce)
//----------
function easeOutBounce(t,c,d)
     {
     t=t/d;
     if(t<(1/2.75))
          {
          a2=c*(7.5625*t*t);return a2;
          }
     else if(t<(2/2.75))
          {
          t=t-(1.5/2.75);
          a2=c*(7.5625*t*t+.75);return a2;
          }
     else if(t<(2.5/2.75))
          {
          t=t-(2.25/2.75);
          a2=c*(7.5625*t*t+.9375);return a2;
          }
     else
          {
          t=t-(2.625/2.75);
          a2=c*(7.5625*t*t+.984375);return a2;
          }
     }//f(easeOutBounce)

fadeAtoB_cScheme


//color scheme for fadeAtoB.fla
_global._cScheme=new Array();
_cScheme['white']=new Array(255,255,255);

filesAndFolders3


/*
filesAndFolders ©2006,7 by Kristoffe Brodeur
-
checkDir               (sentHTTPRoot,sentRoot,sentFolder,phpDirTF)
ffl_findFiles          (sentRootDir,sentFolder,sentFileType)
ffl_loadFolders          (sentRootDir)
ffl_fileExists          (sentPathAndFile)
ffl_eraseFile          (sentDir,sentFile)
ffl_eraseFolder          (sentDir)
ffl_createDir          (sentRootDir,sentDir)
-
12-21-2006
12-28-2006           added checkDir
01-16-2006           added ffl_eraseFile
05-22-2007
07-17-2008
07-08-2007     added php path variable for ffl_fileExists
*/
//-----
function ffl_createDir(sentHTTPRoot,sentRoot,sentDir)
     {
     this.l_create=new LoadVars();
     this.l_create.instruction="create_dir";
     this.l_create.rootDir=sentRoot;
     this.l_create.dir=sentDir;
     this.l_create.root=this;
     this.l_create.onLoad=function(success)
          {
          if(success)
               {
               this.root.loadAction();
               }
          }
     //this.l_create.send(sentHTTPRoot+"PHP_routines_v2.php","POST");
     this.l_create.sendAndLoad(sentHTTPRoot+"PHP_routines_v2.php",this.l_create,"POST");
     }
//----------
function checkDir(sentHTTPRoot,sentRoot,sentFolder,phpDirTF)
     {
     if(!sentHTTPRoot){sentHTTPRoot="";}
     if(!sentRoot){sentRoot="";}
     if(!sentFolder){sentFolder="";}
     if(!phpDirTF){phpDirTF=false;}
     dir="";
     //
     if(sentHTTPRoot!="")
          {
          dir=sentHTTPRoot+"/";
          //
          }//if
     else
          {
          dir="./";
          }
     //trace("after http check:"+dirCD);
     //
     if(sentRoot!="")
          {
          //
          dir+=sentRoot+"/";
          }
     //trace("after root check:"+dirCD);
     //
     if(sentFolder!="")
          {
          //
          dir+=sentFolder+"/";
          }
     //trace("after folder check:"+dirCD);
     //my find files doesnt like that leading /
     if(phpDirTF==true)
          {
          dir=dir.substr(0,dir.length-2);
          }     
     return(dir);
     }//f(checkDir)
//----------
function ffl_findFiles(sentPhpFile,sentFolder,sentFileType)
     {
     //trace("-----"+newline+"ffl_findFiles:"+sentPhpFile+newline+sentFolder+newline+sentFileType);
     //note swf calling ffl_findFiles and html page holding swf MUST BE in the same folder/path
     //maybe the PHP too
     this.fList=new Array();
     this.l_fList=new LoadVars();
     this.l_fList.fldr=sentFolder;
     this.l_fList.fType=sentFileType;
     this.l_fList.par=this;
     this.l_fList.onLoad=function(success)
          {
          trace("loaded files...");
          //
          if(this.files!=undefined)
               {               
               this.par.empty=1;
               //trace("<files:"+this.files+":"+this.par+">");
               this.par.loadStatus=1;
               if(this.files!="")
                    {
                    this.par.empty=0;
                    this.par.fList=this.files.split(",");
                    }
               this.par.loadAction();
               }
          else
               {
               trace("[ffl_findFiles]failure!");
               this.par.loadStatus=-1;
               this.par.loadAction();                              
               }
          }
     //this.l_fList.send(sentPhpFile,"POST");
     this.l_fList.sendAndLoad(sentPhpFile,this.l_fList,"POST");
     }
//----------
function ffl_fldrs_and_filecnt(sentPhpFile,sentRootDir,sentType)
     {
     this.folderList=new Array();
     this.l_folderNames=new LoadVars();
     this.l_folderNames.instruction="list_dir";
     this.l_folderNames.rootDir=sentRootDir;
     this.l_folderNames.fileType=sentType;
     this.l_folderNames.root=this;
     this.l_folderNames.onLoad=function(success)
          {
          //
          if(success)
               {
               this.root.empty=true;
               //dirList is sent back by PHP to flash
               if(this.folders!="~")
                    {
                    this.root.folderList=this.folders.split(",");
                    this.root.empty=false;
                    }
               this.root.loadAction();
               }
          }
     //this.l_folderNames.send(sentPhpFile,"POST");
     this.l_folderNames.sendAndLoad(sentPhpFile,this.l_folderNames,"POST");
     }
//----------
function ffl_loadFolders(sentPhpFile,sentRootDir)
     {
     //trace("php?"+sentPhpFile);
     this.folderList=new Array();
     this.l_folderNames=new LoadVars();
     this.l_folderNames.instruction="list_dir";
     this.l_folderNames.rootDir=sentRootDir;
     this.l_folderNames.root=this;
     this.l_folderNames.onLoad=function(success)
          {
          //
          if(success)
               {
               //dirList is sent back by PHP to flash
               this.root.folderList=this.dirList.split(",");
               trace(this.dirList);
               this.root.loadAction();
               }
          }
     //this.l_folderNames.send(sentPhpFile,"POST");
     this.l_folderNames.sendAndLoad(sentPhpFile,this.l_folderNames,"POST");
     }
//-----
function ffl_folderExists(sDir,sPhpPath,sFolder)
     {
     this.exists=false;
     this.l_fExist=new LoadVars();
     this.l_fExist.file=sFolder;
     this.l_fExist.type="folder";
     this.l_fExist.path=sDir;
     this.l_fExist.par=this;
     this.l_fExist.onLoad=function(success)
          {
          //
          if(success)
               {
               tF_debug.text="exists?"+success+newline+this.exists+"???";
               this.par.loadAction(this.exists);
               }
          }
     pFile=sPhpPath+"ifExists.php";
     this.l_fExist.send(pFile,"POST");
     //this.l_fExist.sendAndLoad(pFile,this.l_fExist,"POST");
     }
//-----
function ffl_fileExists(sentPathAndFile,sentPhpPath)     //ifExists.php
     {
     //php returns this.exists=true if file is found;
     this.exists=false;
     this.l_fExist=new LoadVars();
     this.l_fExist.file=sentPathAndFile;
     this.l_fExist.test="kristoffe";
     this.l_fExist.par=this;
     this.l_fExist.onLoad=function(success)
          {
          tmp1=false;
          //
          if(success)
               {
               //
               if(this.exists=="true")
                    {
                    tF_debug.text+="~"+this.exists+newline;
                    tmp1=true;
                    }
               this.par.exists=tmp1;
               this.par.loadAction(tmp1);
               }
          }
     pFilename="ifExists.php";
     //
     if(!sentPhpPath)
          {
          sentPhpFile=pFilename;
          }
     else
          {
          sentPhpFile=sentPhpPath+pFilename;
          }
     tF_debug.text="[file?]"+sentPathAndFile;
     //this.l_fExist.send(sentPhpFile,"POST");
     this.l_fExist.sendAndLoad(sentPhpFile,this.l_fExist,"POST");
     }
//-----
function ffl_renameFolder(sentPhpPath,dirRoot,dirOld,dirNew)
     {
     trace("RENAME FOLDER!");
     this.l_rename=new LoadVars();
     this.l_rename.instruction="renDirWin";
     this.l_rename.dirRoot=dirRoot;
     this.l_rename.dirOld=dirOld;
     this.l_rename.dirNew=dirNew;
     this.l_rename.root=this;
     this.l_rename.onLoad=function(success)
          {
          if(success)
               {
               this.root.loadAction();
               }
          }
     //this.l_rename.send(sentPhpPath+"PHP_routines_v2.php","POST");
     this.l_rename.sendAndLoad(sentPhpPath+"PHP_routines_v2.php",this.l_rename,"POST");
     }
//-----
function ffl_eraseFolder(sentPhpPath,sentDir)
     {
     trace("ERASE FOLDER!");
     this.l_erase=new LoadVars();
     this.l_erase.instruction="remove_dir";
     this.l_erase.dir=sentDir;
     this.l_erase.root=this;
     this.l_erase.onLoad=function(success)
          {
          if(success)
               {
               this.root.loadAction();
               }
          }
     //this.l_erase.send(sentPhpPath+"PHP_routines_v2.php","POST");
     this.l_erase.sendAndLoad(sentPhpPath+"PHP_routines_v2.php",this.l_erase,"POST");
     }
//-----
function ffl_eraseFile(sentPhpPath,sentDir,sentFile)
     {
     this.l_erase=new LoadVars();
     this.l_erase.instruction="delete_file";
     this.l_erase.dir=sentDir;
     this.l_erase.filename=sentFile;
     this.l_erase.root=this;
     this.l_erase.onLoad=function(success)
          {
          if(success)
               {
               this.root.loadAction();
               }
          }
     trace(sentPhpPath);
     trace(sentDir);
     trace(sentFile);
     //this.l_erase.send(sentPhpPath+"PHP_routines_v2.php","POST");
     this.l_erase.sendAndLoad(sentPhpPath+"PHP_routines_v2.php",this.l_erase,"POST");
     }
//----------

fx


fx_glow.prototype.do_alpha=function()
     {
     aData=this.animArray["alpha"].split(":");
     this.mach_alpha=this.instance.createEmptyMovieClip("glow_alpha",100);
     //switched the ref'd array positions. in # and alpha, its easier to see 0:100:easeType:30(len)
     tDist=parseFloat(aData[1]);
     tTime=parseInt(aData[3]);
     //
     this.e_alpha=new ease(
                               this.mach_alpha,
                               "#",
                               aData[2],
                               this.o_alpha,
                               tDist,
                               tTime
                               );
     this.e_alpha.par=this;
     this.e_alpha.useNum=function(sentVal)
          {
          this.par.p_alpha=sentVal;
          this.par.cntSwitches();
          }
     this.e_alpha.numDone=function()
          {
          this.par.switches_total--;
          this.par.cntSwitches();
          }
     this.e_alpha.easeNum();
     }
//----------
fx_glow.prototype.go_glow=function()
     {
     this.switches_on=0;
     tmp1=this.o_alpha+this.p_alpha;
     tmp2=tmp1/100;
     this.f_glow.alpha=tmp2;
     this.tgtObj.filters=[this.f_glow];
     }
//----------
fx_glow.prototype.cntSwitches=function()
     {
     //
     if(this.switches_total!=0)
          {
          this.switches_on++;
          //
          if(this.switches_on==this.switches_total)
               {
               this.go_glow();
               }
          }
     else
          {
          this.glowDone();
          }
     }
//----------
fx_glow.prototype.initAnim=function()
     {
     t2=this.animArray;
     if(t2["alpha"])
          {
          this.switches_total++;
          this.do_alpha();
          }
     }
//----------
fx_glow.prototype.revDir=function()
     {
     if(this.animArray["alpha"])
          {
          aData=this.animArray["alpha"].split(":");
          //take aData[1] distance and make it the start
          //make the dist the -(start) so it goes to the original value
          x1=parseInt(aData[1]);
          x2=-parseInt(aData[1]);
          //turn back into a string for evaluation transparent to other functions
          this.animArray["alpha"]=x1+":"+x2+":"+aData[2]+":"+aData[3];
          }
     return 0;
     }
//----------
fx_glow.prototype.go=function()
     {
     t1=this.animArray["defaults"];
     //
     if(this.rev==true)
          {
          tmp=this.revDir();
          }
     if(this.animArray["alpha"])
          {
          aData=this.animArray["alpha"].split(":");
          this.p_alpha=this.o_alpha=parseFloat(aData[0]);
          }
     else
          {
          this.p_alpha=parseFloat(t1[1]);
          }
     this.p_color=t1[0];
     this.p_blurX=parseFloat(t1[2]);
     this.p_blurY=parseFloat(t1[3]);
     this.p_strength=parseFloat(t1[4]);
     this.p_quality=parseFloat(t1[5]);
     this.p_inner=t1[6];
     this.p_knockout=t1[7];
     this.f_glow=new flash.filters.GlowFilter(
                                                        t1[0],
                                                        this.p_alpha/100,
                                                        t1[2],
                                                        t1[3],
                                                        t1[4],
                                                        t1[5],
                                                        t1[6],
                                                        t1[7]
                                                        );
     this.tgtObj.filters=[this.f_glow];
     this.instance=this.tgtObj.createEmptyMovieClip("fx_glow1",1000);
     this.initAnim();
     }
//----------
function fx_glow(sentTgtObj,sArr)
     {
     //trace("[fx_glow]"+sentTgtObj+":"+sArr["defaults"]);
     this.rev=false;
     this.tgtObj=sentTgtObj;
     this.switches_total=0;
     this.switches_on=0;
     //*.slice() -> the new Array will have a copy and not a reference of the fully sliced Array
     this.animArray=sArr.cloneAssocArray();
     }
//----------
//var gTest=new Array();
//alpha string:start:finish:easeType:length
//gTest["defaults"]=new Array(0xFFFFFF,.95,32,32,2,1,false,false);
//gTest["alpha"]=("0:50:easeLinear:30");
//
//var glowTest1=new fx_glow(mc_girl_glow,gTest);
//glowTest1.go();

fx_mc


//fx_mc ver 1.0
//by Kristoffe Brodeur
//06-25-2006
//

gallery_cScheme


//color scheme for fadeAtoB.fla
_global._cScheme=new Array();
_cScheme['white']=new Array(255,255,255);

loadXML2


//loadXML2.as by kristoffe brodeur
//v2.0 01-11-2007
//----------
function loadXML(lX_targetObj)
     {
     trace("[loadXML]("+lX_targetObj.filename+")");
     lX_targetObj.onLoad=function(success)
          {
          //success is a binary function; positive on a good load
          if(success)
               {
               tF_debug.text+="XML loaded.";
               //this refers to the onLoad parent, dataXML, which is the actual XML data
               //therefore, onLoad is just an attribute and fucntion of the main object dataXML
               //tF_debug.text+=newline+"data:"+lX_targetObj;          
               lX_targetObj.loadAction();
               }//if
          }//f()
     lX_targetObj.ignoreWhite=true;
     lX_targetObj.load(lX_targetObj.filename);
     }//f()

load_httpRoot


//findRoot v1.0 by Kristoffe Brodeur. ©2009 All Rights Reserved.
//03-22-2009 made finding the httpRoot with path.php an extrenal class
//
//-----
function load_httpRoot(phpPath,defaultRoot,action)
     {
     //
     if(phpPath==undefined)
          {
          phpPath="";
          }
     tF_debug.text="site address root"+newline+">>>";
     trace("loading httpRoot from PHP. this does NOT work testing in flash, uncomment the addy at the top and put your current test dir");
     //calendar.swf is ../path.php
     //but it is loaded from mS/calendar/calendar.html where calendar.swf is embedded
     //so it is ../../path.php relative to the html not the swf location
     filename=phpPath+"path.php";//this works if path.php is in root, and you have loaded anything in an html file, it still thinks you are in root
     T1.lH=new LoadVars();
     T1.lH.onData=function(src)
          {
          test=src.substr(0,5);
          tF_debug.text+=newline+src;
          trace("src["+test+"]");
          tF_debug.text="[src]"+src;
          //
          if(src.substr(0,5)=="<?php")
               {
               //youre trying this in flash, so we'll hardcode that addy
               trace("***cant find httpRoot in flash environment, using a hardcorded one...");
               tF_debug.text+=newline+"***cant find httpRoot in flash environment, using a hardcorded one...";
               T1.root.httpRoot=defaultRoot;
               }
          else
               {
               if(src!=undefined)
                    {
                    T1.root.httpRoot=src;
                    }
               else
                    {
                    T1.root.httpRoot=defaultRoot;
                    }
               }
          trace("?"+T1.root.httpRoot);
          tF_debug.text+=newline+"httpRoot>"+T1.root.httpRoot;
          action();
          }
     T1.lH.load(filename);
     }

load_XML


//
//
//
function XML_2_string(original_XML)
     {
     //[<][>][/] to be replaced with [(][)][^] so I can use POST to PHP
     var searchString=original_XML.toString();
     var translated;
     for(i=0; i<searchString.length; i++)
          {
          if (searchString.charAt(i)== "<")
               {
               translated=translated+"(";                              
               }
          else if (searchString.charAt(i)== ">")
               {
               translated=translated+")";                    
               }
          else if (searchString.charAt(i)== "/")
               {
               translated=translated+"^";
               }
          else
               {
               translated=translated+searchString.charAt(i);
               }
          }
     return(translated);
     }
//
//
//
function load_XML(XML_filename,level)
     {
     var XML_1a=new xml();
     XML_1a.ignorewhitespace=true;
     XML_1a.onload=
          function(success)
               {
               if (success)
                    {
                    //swf calling must have this function in it
                    //to do whatever it wants with the called data
                    //
                    //trace("success! "+XML_filename);
                    level.XML_return(XML_1a,XML_filename);
                    }

               else
                    {
                    //again, calling the function to return nothing(0)
                    //to let the swf know there was a failure
                    //
                    level.XML_return(0);
                    }

               };
          
     XML_1a.load(XML_filename);
     }

MultiLineCell2


//ActionScript 2.0 class.
class MultiLineCell extends mx.core.UIComponent
     {
private var multiLineLabel;
private var owner;
private var listOwner;
private static var PREFERRED_HEIGHT_OFFSET = 4;
private static var PREFERRED_WIDTH = 100;
private var startDepth:Number = 1;
public function MultiLineCell()
     {
      }
public function createChildren():Void
     {
      var c = multiLineLabel = this.createLabel("multiLineLabel", startDepth);
      c.styleName = listOwner;
      c.selectable = false;
      c.tabEnabled = false;
      c.background = false;
      c.border = false;
      c.multiline = true;
      c.wordWrap = true;
      }
public function size():Void
     {
     var c = multiLineLabel;
c.setSize(__width, __height);
     }
public function getPreferredHeight():Number
     {
return owner.__height - PREFERRED_HEIGHT_OFFSET;
     }
public function setValue(suggestedValue:String, item:Object, selected:Boolean):Void
     {
          if (item==undefined)
               {
multiLineLabel.text._visible = false;
     }
multiLineLabel.text = suggestedValue;
     }
     }

phpFileIO


//--------------------------------------------------------------------------------------------
//php file routines for flash mx as 1.0~2.0
//by Kristoffe Brodeur
//--------------------------------------------------------------------------------------------
#include "arrayFunctions.as"
//--------------------------------------------------------------------------------------------
PHP_findJpgs=function(sentFolder)
     {
     this.folder=sentFolder;
     }//f(PHP_findJpgs)
//--------------------------------------------------------------------------------------------
PHP_findJpgs.prototype.findPics=function()
     {
     getList=new LoadVars();
     getList.folder=this.folder;
     getList.parent=this;
     getList.onLoad=function(success)
          //
          {
          if(success)
               {
               this.files=crypto(this.files,"^"," ");
               //
               var tempNames=this.files.split(",");
               //
               if(tempNames.length>0)
                    {
                    //
                    _root.tF_debug.text=tempNames;
                    this.parent.picList=tempNames;
                    this.parent.callback();
                    }//if
               }//if(success)
          }//f(success)
     getList.sendAndLoad("00_findJpgs.php",getList,"POST");
     }//f(findPics)
//--------------------------------------------------------------------------------------------

pngButtonTrans


import flash.display.BitmapData;
import flash.geom.Point;
//pngButton transparency class by Kristoffe Brodeur. ©2008 All Rights Reserved.
//11-23-2008
pngButton.prototype.pngAlign=function(sObj)
     {
     trace("!!"+sObj);
     switch(this.alignType)
          {
          case "center":
               sObj._x-=sObj._width/2;
               sObj._y-=sObj._height/2;
               break;
          }
     }
//-----
pngButton.prototype.initBmp=function()
     {
     this.bitmap1=new BitmapData(this.mc_pngOff._width,this.mc_pngOff._height,true,0x00000000);//
     this.mc_pngBmp=this.pngPar.createEmptyMovieClip("pngBmp",101);
     this.mc_pngBmp.attachBitmap(this.bitmap1,101);
     this.bitmap1.draw(this.mc_pngOff);
     this.pngAlign(this.mc_pngBmp);//align after it draws, or it wont align correctly!
     tgt=this.mc_pngBmp;     
     tgt.bmp=this.bitmap1;
     tgt.pngHit=false;
     tgt._par=this;
     //
     tgt.onRollOver=function()
          {
          this.onEnterFrame=function()
               {
               tX=this._xmouse;
               tY=this._ymouse;
               nullP=new Point(0,0);
               cp=new Point(tX,tY);
               ltgP=new Point(tX,tY);
               this.localToGlobal(ltgP);
               this.xHair._y=cp.y;
               this.yHair._x=cp.x;               
               //hitTest
               //nullP=a test point at (0,0)???
               //0=anything past 0 alpha, this can be 0~255, 255 would never work
               //cp=where the
               checkHit=this.bmp.hitTest(nullP,0,cp);
               //trace(checkHit);
               if(checkHit==true)
                    {
                    //the bitmap goes invisible, just incase the Png On has a different shape
                    //and it is seen under it when the on is visible
                    this._visible=false;
                    this._par.mc_pngOn._visible=true;
                    }
               else
                    {
                    //the bitmap shows itself again because it was turned off above just incase of
                    //on and off shape differences
                    this._visible=true;
                    this._par.mc_pngOn._visible=false;
                    }
               }
          }
     }
//-----
pngButton.prototype.loadOn=function()
     {
     this.mc_pngOn=this.pngPar.createEmptyMovieClip("pngOn",102);
     this.mc_pngOn._par=this;
     this.mc_pngOn.loadAction=function()
          {
          this._par.pngAlign(this);
          this._visible=false;
          this._par.initBmp();
          }
     this.mc_pngOn.loadMC(this.pngOn+".png");
     }
//-----
pngButton.prototype.loadOff=function()
     {
     this.mc_pngOff=this.pngPar.createEmptyMovieClip("pngOff",100);
     this.mc_pngOff._par=this;
     this.mc_pngOff.loadAction=function()
          {
          this._par.pngAlign(this);
          this._visible=false;
          this._par.loadOn();
          }
     this.mc_pngOff.loadMC(this.pngOff+".png");
     }
//-----
function pngButton(sParent,sOff,sOn,sAlign)
     {
     //trace("new pngButton:"+sOff+":"+sOn);
     //sOff=filename of png in off state
     //sOn=filename of png in on state
     this.pngPar=sParent;
     this.alignType=sAlign;
     this.pngOff=sOff;
     this.pngOn=sOn;
     this.loadOff();
     }
trace("pngButtonTrans.as loaded");

sortNode2


//sortNode.as by Kristoffe Brodeur. (c)2007 All Rights Reserved.
//03-16-2007 v2.0 using this and simple resigters to accumlate links
//----------
function patternPos(sentChar,sentPattern)
     {
     sentChar=sentChar.toLowerCase();
     _pos=-1;
     //
     do
          {
          _pos++;
          patChr=sentPattern.substr(_pos,1);
          }
          while(sentChar!=patChr);
     return(_pos);
     }
//----------
function cmp_shortest(orig,test)
     {
     finalLen=-1;
     //
     if(orig.length<test.length){finalLen=orig.length;}
     if(test.length<orig.length){finalLen=test.length;}
     if(test.length==orig.length){finalLen=orig.length;}
     //
     return(finalLen);
     }
//----------
function cmp_strings(origStr,testStr,sentPattern)
     {
     //tF_debug.text+=newline+"[o]"+origStr+":[t]"+testStr;
     pattern=sentPattern;
     //origStr="apple";
     //testStr="zzzzz";
     //after=1 if origStr="apple" && testStr="zebra";
     //after=0 if origStr="zebra" && testStr="apple";
     //
     cLen=cmp_shortest(origStr,testStr);
     sortFound=-1;
     sortAtEnd=-1;
     oLen=origStr.length;
     tLen=testStr.length;
     //
     b1=-1;
     do
          {
          b1++;
          o_testChr=origStr.substr(b1,1);
          t_testChr=testStr.substr(b1,1);
          o_foundPos=patternPos(o_testChr,pattern);
          t_foundPos=patternPos(t_testChr,pattern);
          //tF_trace.text+=newline+("["+o_foundPos+":"+t_foundPos+"]"+newline+"-----");
          //
          if(o_foundPos<t_foundPos)
               {
               //tF_debug.text+=newline+(o_testChr+"<"+t_testChr);
               sortFound=1;
               sortAtEnd=1;
               }
          //
          if(t_foundPos<o_foundPos)
               {
               //tF_debug.text+=newline+(o_testChr+">"+t_testChr);
               sortFound=1;
               sortAtEnd=0;
               }
          //
          if(o_foundPos==t_foundPos){}
          }
          while(b1<cLen-1&sortFound==-1);//cLen-1 or else it will loop and b1 will be 1 over     
     //
     if(sortFound==-1)
          {
          //tF_debug.text+=newline+("NOT FOUND YET!");
          //
          if(oLen<tLen)
               {
               sortFound=1;
               sortAtEnd=1;
               }
          //
          if(oLen>tLen)
               {
               sortFound=1;
               sortAtEnd=0;
               }
          //
          if(oLen==tLen)
               {
               sortFound=1;
               sortAtEnd=1;
               }
          }
     //
     if(sortAtEnd==1)//test goes after orig
          {
          sortID="AFTER";
          }
     else
          {
          sortID="BEFORE";//test goes before orig
          }
     //tF_debug.text+=newline+("SORTED!"+newline+testStr+" "+sortID+" "+origStr);
     return(sortAtEnd);
     }
//----------
function linkedList(sentArray)
     {
     lList=new Array();
     //
     for(ll=0;ll<sentArray.length;ll++)
          {
          lList[ll]=new Object();
          lList[ll].str=sentArray[ll];
          lList[ll].par=-1;//no link
          lList[ll].chi=-1;//no link
          }
     //trace("linkedList created");
     return(lList);
     }
//----------
sort_array.prototype.output=function()
     {
     trace("[output]->pause");
     this.coolPoint="outputGO";
     this.coolDown();     
     }
//----------
sort_array.prototype.outputGO=function()
     {
     trace("[outputGO]");
     this.linkPos=this.baseNode;
     //trace("baseNode"+this.baseNode);
     //trace("endNode"+this.endNode);
     //
     for(i=0;i<this.sortLen;i++)
          {
          tgt=this.lLA[this.linkPos];
          //trace("("+i+")["+tgt.par+"]"+tgt.str+"["+tgt.chi+"]");
          this.sorted[i]=tgt.str;
          this.linkPos=this.lLA[this.linkPos].chi;
          }
     //trace("[output]"+i+" items sorted.");
     //trace("[output]"+this.sorted);
     this.sortAction();
     }
//----------
sort_array.prototype.cmp_nextNodeGO=function()
     {
     this.nNext=this.lLA[this.cmpTgt];
     this.isCurrAft=cmp_strings(this.nNext.str,this.nCurr.str,this.pat);
     //trace("[cmp_nextNodeGO]"+this.nNext.str+":"+this.nCurr.str);
     //
     if(this.isCurrAft==0)
          {
          //trace("n>before");
          this.nPrev=this.lLA[this.nNext.par];//identify nPrev with linked list lLA[#this nNext.par]
          this.nCurr.par=this.nNext.par;
          this.nPrev.chi=this.sortPos;
          this.nNext.par=this.sortPos;
          this.nCurr.chi=this.cmpTgt;
          this.incr_sort();
          }
     //
     else
          {
          //trace("n>after");
          //
          if(this.nNext.chi==-1)
               {
               //trace("endNode");
               this.nNext.chi=this.sortPos;
               this.nCurr.par=this.cmpTgt;
               this.nCurr.chi=-1;
               this.endNode=this.cmpTgt;
               this.incr_sort();
               }
          else
               {
               //trace("->nextNode");
               this.cmpTgt=this.nNext.chi;
               this.cmp_nextNode();
               }
          }
     }
//----------
sort_array.prototype.cmp_nextNode=function()
     {
     //trace("[cmp_nextNode]"+this.procCurr+":"+this.procLimit);
     if(this.procCurr==this.procLimit)
          {
          this.coolPoint="cmp_nextNode";
          this.coolDown();
          }
     else
          {
          this.cmp_nextNodeGO();
          }
     }
//----------
sort_array.prototype.cmp_prevNodeGO=function()
     {
     this.procCurr++;
     this.nPrev=this.lLA[this.cmpTgt];
     this.isCurrAft=cmp_strings(this.nPrev.str,this.nCurr.str,this.pat);
     //trace("[cmp_prevNodeGO]["+this.nPrev.par+"]"+this.nPrev.str+"["+this.nPrev.chi+"]:"+this.nCurr.str);
     //
     if(this.isCurrAft==0)
          {
          //trace("p>before");
          //
          if(this.nPrev.par==-1)
               {
               //trace("baseNode");
               this.nPrev.par=this.sortPos;
               this.nCurr.chi=this.cmpTgt;
               this.nCurr.par=-1;
               this.baseNode=this.sortPos;
               this.incr_sort();
               }
          //
          else
               {
               //trace("->prevNode");
               this.cmpTgt=this.nPrev.par;
               this.cmp_prevNode();
               }
          }
     else
          {
          //trace("p>after");
          //
          if(this.nPrev.chi==-1)
               {
               //trace("endNode");
               this.nPrev.chi=this.sortPos;
               this.nCurr.par=this.cmpTgt;
               this.endNode=this.cmpTgt;
               this.incr_sort();
               }
          else
               {
               //trace("->nextNode");
               this.cmpTgt=this.nPrev.chi;
               this.cmp_nextNode();
               }
          }
     }
//----------
sort_array.prototype.cmp_prevNode=function()
     {
     //trace("[cmp_prevNode]"+this.procCurr);
     if(this.procCurr==this.procLimit)
          {
          this.coolPoint="cmp_prevNode";
          this.coolDown();
          }
     else
          {
          this.cmp_prevNodeGO();
          }
     }
//----------
sort_array.prototype.warmUp=function()
     {
     clearInterval(this._breathe);
     trace("[warmUp]");
     this.procCurr=0;
     //
     switch(this.coolPoint)
          {
          case"cmp_prevNode":
          trace("->prev warmUp");
          this.cmp_prevNode();
          break;
          //
          case"cmp_nextNode":
          trace("->next warmUp");
          this.cmp_nextNode();
          break;
          //
          case"outputGO":
          trace("->outputGO");
          this.outputGO();
          break;
          }
     }
//----------
sort_array.prototype.coolDown=function()
     {
     trace("[coolDown]"+this.coolPoint);
     this._breathe=setInterval(this,"warmUp",50);
     }
//----------
sort_array.prototype.init_cmp_prevNode=function()
     {
     this.cmpTgt=this.sortPos-1;
     this.nCurr=this.lLA[this.sortPos];//string to compare for whole series of tests on this.sCurr
     //trace("[init_cmp_prevNode]'"+this.nCurr.str+"'");     
     this.cmp_prevNode();
     }
//----------
sort_array.prototype.incr_sort=function()
     {
     this.sortPos++;
     trace("----------[this.sortPos]"+this.sortPos);
     //
     if(this.sortPos!=this.sortLen)
          {
          this.init_cmp_prevNode();
          }
     else
          {
          this.output();
          }     
     }
//----------
sort_array.prototype.go=function()
     {
     trace("[go]");
     this.incr_sort();
     }
//----------
function sort_array(sentArray,sentPattern)
     {
     tF_debug.text+=newline+"[sort_array]";
     //tF_debug.text+=newline+sentArray+":"+sentPattern;
     this.coolPoint="";//pause and continue branch string
     this.procLimit=40;
     this.procCurr=-1;
     this.lLA=linkedList(sentArray);
     this.sortLen=sentArray.length;
     this.sortPos=0;//start comparing nodes at position1(++), second node from 0
     this.cmpTgt=-1;
     this.pat=sentPattern;
     this.baseNode=0;//first node we never check
     this.endNode=0;//same
     this.sorted=new Array();
     }
//----------

textFunctions


//textFunctions.as (c)2007 by Kristoffe Brodeur
//03-09-2007 made sure char[13] is not in text from a local text read[windows]
//----------     
function loadText(sentFileName)
     {
     this.tData="";
     this.lText1=new LoadVars();
     this.lText1.par=this;
     this.lText1.onData=function(src)
          {
          this.par.tData=src;
          this.par.loadAction();
          }
     this.lText1.load(sentFileName);
     }
//----------
function text_fixRet(sentString)
     {
     //13 is a flash/windows thing. in linux on linux servers text files doent see [10][13] just [10]
     //so in either case, just omit [13], because [10] is the newline you want anyway
     //[10][13] happens in a carriage return in windows notepad.exe from what i've seen. maybe all simple windows text editors
     newText="";
     //
     for(tF=0;tF<sentString.length;tF++)
          {
          //
          t1=sentString.charCodeAt(tF);
          t2=sentString.charCodeAt(tF+1);
          //
          if(t1!=13)
               {
               newText+=sentString.charAt(tF);
               }
          }
     return(newText);
     }

thumbnailer


//Thumbnailer Object Function by Kristoffe Brodeur. All rights reserved. (c)2006
//------------------------------------------------------
//Thumbnailer update and customization
//06-14-2006
//------------------------------------------------------
Thumbnailer.prototype.clearThumbs=function()
     {
     log1.addItem("[clearThumbs]");
     //
     if(this.thBase.instance)
          {
          removeMovieClip(this.thBase.instance);
          }//if
     //
     clearArray(this.thumbIcons);
     this.tnBase=new createMC(this.mcPar,"em_placer","thBase1",10,0,0);          
     }//f(clearThumbs)
//----------
Thumbnailer.prototype.placePic=function(picName)
     {
     t1=new MovieClipLoader();
     t1.parent=this;
     t1.onLoadInit=function(mc)
          {
          limitResize(this.parent.visPicLimX,this.parent.visPicLimY,mc._width,mc._height);
          mc._x=this.parent.picArea._x+((this.parent.visPicLimX-destProp.w)/2);
          mc._y=this.parent.picArea._y+((this.parent.visPicLimY-destProp.h)/2);
          mc._width=destProp.w;
          mc._height=destProp.h;
          mc._alpha=0;
          fadeInClip(mc,10);
          }//f()
     t1.loadClip(picName,G1.em_pic.instance);
     }//f(placePic)
//----------
Thumbnailer.prototype.setup_glows=function()
     {
     log1.addItem("[setup_glows]");
     gw=gh=4;
     gColor=0x9F9FFF;
     gSpd=15;
     gSpt=gSpd.toString();
     alp=75;
     str=6;
     alpT=alp.toString();
     this.glow_old=new Array();
     this.glow_old["defaults"]=new Array(gColor,alp/100,gw,gh,str,4,true,false);
     this.glow_old["alpha"]=(alpT+":-"+alpT+":easeLinear:"+gSpt);
     //
     this.glow_new=new Array();
     //alpha string:start:finish:easeType:length
     this.glow_new["defaults"]=new Array(gColor,.0,gw,gh,str,4,true,false);
     this.glow_new["alpha"]=("0:"+alpT+":easeLinear:"+gSpt);
     }
//----------
Thumbnailer.prototype.glowIcon=function()
     {
     if(     this.prev_thumbPos!=-1)
          {
          this.icon_glowOld=new fx_glow(this.icon_prev,this.glow_old);
          this.icon_glowOld.go();
          }
     this.prev_thumbPos=this.thumbPos;
     this.icon_prev=this.icon_curr;
     //
     this.icon_glowNew=new fx_glow(this.icon_curr,this.glow_new);
     this.icon_glowNew.go();
     }
//----------
Thumbnailer.prototype.dispThumb=function()
     {
     //find floor of the row down by the amount of LimX that fits in thumbPos
     tempY=Math.floor(this.thumbPos/this.thAmtLimX);
     //find the % remainder of thumbPos divided by the LimX amount of horizontial thumbnails
     tempX=this.thumbPos%this.thAmtLimX;
     tXPos=5+(tempX*this.thumbX+5);
     tYPos=5+(tempY*this.thumbY+5);
     this.thumbIcons[this.thumbPos]=new createMC(this.tnBase.instance,"mc_phpWorking","mc_thumb",100+this.thumbPos,tXPos,tYPos,0,4,4,0);
     this.thumbBack[this.thumbPos]=new createMC(this.tnBase.instance,"mc_phpWorking","mc_tLoadIcon",1300+this.thumbPos,tXPos,tYPos,0,4,4,0);
     //----------------------------------------------------------------------------------------
     tmp1=this.httpRoot+this.rootDir+"/"+this.currDir+"/";
     thName=tmp1+"t_"+this.fileNames[this.filePos].fName+".jpg";
     picName=tmp1+this.fileNames[this.filePos].fName+".jpg";
     //
     targetThumb=this.thumbIcons[this.thumbPos].instance;
     targetThumb.MCL=new MovieClipLoader();
     targetThumb.MCL.picAddy=picName;
     targetThumb.MCL.parent=this;
     targetThumb.MCL.pos=this.thumbPos;
     targetThumb.MCL.onLoadInit=function(mc)
          {
          removeMovieClip(this.parent.thumbBack[this.pos].instance);
          mc._xscale=100;
          mc._yscale=100;
          tempX=this.parent.thumbX*(Math.floor(this.pos%this.parent.thAmtLimX));
          tempY=this.parent.thumbY*(Math.floor(this.pos/this.parent.thAmtLimX));
          mc._x=tempX+((this.parent.thumbX-mc._width)/2);
          mc._y=tempY+((this.parent.thumbY-mc._height)/2);
          mc.picAddy=this.picAddy;
          mc.parent=this.parent;
          mc.ID=this.pos;
          mc._alpha=0;
          fadeInClip(mc,10);
          mc.onRelease=function()
               {
               this.parent.icon_curr=this;
               this.parent.thumbPos=this.ID;
               this.parent.glowIcon();
               this.parent.placePic(this.picAddy);
               }//f()
          }//f()
     targetThumb.MCL.loadClip(thName,targetThumb);          
     }//f(dispThumb)     
//------------------------------------------------------
Thumbnailer.prototype.drawThumbPage=function(sentID)
     {
     log1.addItem("[drawThumbPage]");
     this.clearThumbs();
     var thAmt=0;
     var tStart=sentID*this.iconLimit;
     //
     if(this.fileCount-tStart>this.iconLimit)
          {
          thAmt=this.iconLimit;
          }
     else
          {
          thAmt=this.fileCount-tStart;
          }
     for(d1=0;d1<thAmt;d1++)
          {
          this.thumbPos=d1;
          this.filePos=tStart+d1;
          this.dispThumb();
          }
     }//f(drawThumbPage)
//------------------------------------------------------
Thumbnailer.prototype.createPageIcons=function()
     {
     pageY=0;
     pLen=Math.ceil(this.fileNames.length/this.iconLimit);
     spacing=4;
     //
     for(x1=0;x1<pLen;x1++)
          {
          pageX=(this.iconSize*x1)+spacing;
          //
          if(x1!=0)
               {
               pageX+=spacing;
               }
          this.pageIcons[x1]=new createMC(this.pgBase.instance,"mc_pageIcon","mcGr_x",200+x1,pageX,pageY);
          tgt=this.pageIcons[x1].instance;
          tgt.tF_text.text=x1+1;//0 is page 1
          //
          if(x1==0)
               {
               this.pageIcons[0].instance._visible=false;
               }//if
          //
          if(x1==1)
               {
               this.pageIcons[0].instance._visible=true;               
               }//else
          tgt.ID=x1;
          tgt.par=this;
          tgt.onRelease=function()
               {
               this.par.drawThumbPage(this.ID);
               }//f()
          }//for(x1)
     //
     this.drawThumbPage(0);
     }//f()
//------------------------------------------------------
Thumbnailer.prototype.getPicList=function()
     {
     getList=new LoadVars();
     getList.folder=this.currDir;
     getList.rootDir=this.rootDir;
     getList.fileType="jpg";
     getList.parent=this;
     getList.onLoad=function(success)
          //
          {
          if(success)
               {
               this.files=crypto(this.files,"^"," ");
               //
               var tempNames=this.files.split(",");
               //
               if(this.files!="")
                    {
                    log1.addItem("f["+this.files+"]");
                    this.parent.fileCount=tempNames.length;
                    //
                    for(tNA=0;tNA<tempNames.length;tNA++)
                         {
                         this.parent.fileNames[tNA]=new Object();
                         this.parent.fileNames[tNA].fName=tempNames[tNA];
                         }//for(tNA)
                    //this program doesnt rebuild jpegs, this one only displays them
                    //this.parent.loopJpegResizer();
                    this.parent.createPageIcons();
                    }//if
               }//if(success)
          }//f(success)
     //getList.send("00_findFileType_v2.php","_blank","GET");
     getList.sendAndLoad("00_findFileType_v2.php",getList,"POST");
     }//f(getPicList)
//------------------------------------------------------
Thumbnailer.prototype.resetViewer=function()
     {
     log1.addItem("[resetViewer]");
     this.picPos=-1;
     this.thumbPage=-1;
     this.thumbPos=-1;
     this.fileCount=-1;
     this.clearThumbs();
     //
     if(this.fileNames)
          {
          clearArray(this.fileNames);
          }
     //
     if(this.tnBase.instance)
          {
          removeMovieClip(this.tnBase.instance);
          removeMovieClip(this.pgBase.instance);
          clearArray(this.pageIcons);
          }//if
     tgtG=new Object();
     tgtG.x=0;
     tgtG.y=0;
     this.mcPar.localToGlobal(tgtG);
     tmpX=em_pages._x-tgtG.x;
     tmpY=em_pages._y-tgtG.y;
     //log1.addItem(em_pages._x+"-"+tgtG.x+"="+tmpX);
     //log1.addItem(em_pages._y+"-"+tgtG.y+"="+tmpY);
     this.pgBase=new createMC(this.mcPar,"em_placer","thPages",1,tmpX,tmpY);          
     this.getPicList();
     }//f()
//------------------------------------------------------
function Thumbnailer(sentHttpRoot,sentRootDir,sentCurrDir,sentMC_par)
     {
     //G1 is a global object container at top, root at level0
     this.root=G1.root;
     this.mcPar=sentMC_par;
     this.iName=sentInstanceName;
     this.rootDir=sentRootDir;
     this.currDir=sentCurrDir;
     this.httpRoot=sentHttpRoot;
     this.currFolder=-1;
     this.prevFolder=-1;
     this.picPos=-1;
     this.thumbPos=-1;
     this.prev_thumbPos=-1;
     this.thumbPage=-1;
     this.fileCount=-1;
     this.filePos=-1;
     this.icon_curr;
     this.icon_prev;
     this.pageIcons=new Array();
     this.fileNames=new Array();
     this.thumbIcons=new Array();
     this.thumbBack=new Array();
     this.picArea=area_pic;
     this.visPicLimX=area_pic._width;
     this.visPicLimY=area_pic._height;
     this.thumbX=48;
     this.thumbY=36;
     this.iconSize=16;
     this.iOffSetX=(this.thumbX-this.iconSize)/2;
     this.iOffSetY=(this.thumbY-this.iconSize)/2;
     this.picLimX=600;
     this.picLimY=400;
     //
     this.thArea=G1.root.area_thumbs;     
     this.thAmtLimX=Math.floor(this.thArea._width/this.thumbX);
     this.thAmtLimY=Math.floor(this.thArea._height/this.thumbY);
     log1.addItem(this.thAmtLimX+":"+this.thAmtLimY);
     this.thumbsHolder_X=(this.thArea._width-(this.thAmtLimX*this.thumbX))/2;
     this.thumbsHolder_Y=(this.thArea._height-(this.thAmtLimY*this.thumbY))/2;;
     this.iconLimit=this.thAmtLimX*this.thAmtLimY;
     this.setup_glows();
     this.resetViewer();
     }//f(Thumbnailer)