The last three functions are the enter frame event to handle all of the filter updating for the depth of field simulation, and the rollover/rollout events for the menu buttons. Lets finish this;


function updatePos(e:Event):void
{
 myFilter1.blurX = -(mySpace.z + f1.z) / 80;
 myFilter2.blurX = (mySpace.z + f2.z) / 80;
 myFilter3.blurX = (mySpace.z + f3.z) / 80;
 myFilter4.blurX = (mySpace.z + f4.z) / 80;
 myFilter5.blurX = (mySpace.z + f5.z) / 80;
 myFilter6.blurX = (mySpace.z + f6.z) / 80;
//
 myFilter1.blurY = myFilter1.blurX;
 myFilter2.blurY = myFilter2.blurX;
 myFilter3.blurY = myFilter3.blurX;
 myFilter4.blurY = myFilter4.blurX;
 myFilter5.blurY = myFilter5.blurX;
 myFilter6.blurY = myFilter6.blurX;
//
 f1.filters = [myFilter1];
 f2.filters = [myFilter2];
 f3.filters = [myFilter3];
 f4.filters = [myFilter4];
 f5.filters = [myFilter5];
 f6.filters = [myFilter6];
//
 SimpleZSorter.sortClips(mySpace);
}


The ENTER_FRAME function here uses some simple math to determine just how blurred each menu item should be. It works like this: it calculates the difference between where the parent clip is on the Z axis and where the children clips are on their Z axis. For the first item you put a '-' before the calculations so that the value returned is negative. That's because you're only ever going to see this item zoom in from behind the viewport, so you really only need to see it blur back in.

The SimpleZSorter class is great because it automatically sorts the depths of all items inside of the parent clip. That is, the depth as in the stage/display depth (child index), not the physical or Z depth. This keep items that are physically further away behind items that are physically closer (Z property). Great stuff.

function bOver(e:MouseEvent):void
{
 if(e.target == b1){
  Tweener.addTween(b1, {x:753.1, time:1});
 }else if(e.target == b2){
  Tweener.addTween(b2, {x:808.8, time:1});
 }else if(e.target == b3){
  Tweener.addTween(b3, {x:881.2, time:1});
 }else if(e.target == b4){
  Tweener.addTween(b4, {x:925.9, time:1});
 }else if(e.target == b5){
  Tweener.addTween(b5, {x:796.7, time:1});
 }else if(e.target == b6){
  Tweener.addTween(b6, {x:845, time:1});
 }
}
//
function bOut(e:MouseEvent):void
{
 if(e.target == b1){
  Tweener.addTween(b1, {x:773.1, time:1});
 }else if(e.target == b2){
  Tweener.addTween(b2, {x:828.8, time:1});
 }else if(e.target == b3){
  Tweener.addTween(b3, {x:901.2, time:1});
 }else if(e.target == b4){
  Tweener.addTween(b4, {x:945.9, time:1});
 }else if(e.target == b5){
  Tweener.addTween(b5, {x:816.7, time:1});
 }else if(e.target == b6){
  Tweener.addTween(b6, {x:865, time:1});
 }
}



The bOver and bOut functions are pretty straight forward. Keep in mind that the values entered into the tweens in these functions are relative to your buttons exact positions on the stage. All you're doing here is determining which button you rolled over/off of and shifting it's X property by 20 pixels. So, for example in bOut if your b1's x property on the stage was 100, you would want that tween value to be x:100 because that tween is designed to return the button to it's original positions. Vise/versa for the bOver function.

Anyway once the code is done and you actually get to use this I hope you enjoy. All of my customers have loved it, it's quite a selling feature. I am chaging my website design in a couple of months so I don't care if people do something similar. I do encourage everyone to personalize this as much as possible. You can go really cookey and make the items kind of FLY/SWING in from the back right and into focus or even add a spin to the animations where the items rotate on their Y axis all kinds of stuff. This is just a kind of platform on which I suspect you'll improve and expand the functions. If you have any questions you can email me ascensionsystems@gmail.com and I'll be sure to bring the question back to the forum to address it in a post some place or another.