# Three DImensional Gallery Question

**URL:** https://forum.kirupa.com/t/three-dimensional-gallery-question/190260
**Category:** flash
**Created:** [June 9, 2006, 7:59pm UTC](https://forum.kirupa.com/t/three-dimensional-gallery-question/190260 "2006-06-09T19:59:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![saveth](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@saveth](https://forum.kirupa.com/u/saveth)
#### Post date: [June 9, 2006, 7:59pm UTC](https://forum.kirupa.com/t/three-dimensional-gallery-question/190260/1 "2006-06-09T19:59:50Z")

</div>

I’m trying to make a gallery out the example found here [http://www.kirupa.com/developer/actionscript/camera\_panning.htm](http://www.kirupa.com/developer/actionscript/camera_panning.htm).

How would I go about applying an alpha value to each item depending on where it’s at.

Example (farthest away = alpha of 0 closest = alpha of 100)

Thanks,  
Saveth

```auto

// ===========================================================
// INITIALIZE SCENE
// ===========================================================
this.createEmptyMovieClip("theScene", 1);
theScene._x = Stage.width/2;
theScene._y = Stage.height/2-10;

objectsInScene = new Array();

focalLength = 1000;
spin = 0;
// ===========================================================

// ===========================================================
// DISPLAY PANE
// ===========================================================
displayPane = function(){
    var angle = this.angle + spin;
    var x = Math.cos(angle)*this.radius;
    var z = Math.sin(angle)*this.radius;
    var y = this.y;
    
    var scaleRatio = focalLength/(focalLength + z);
    this._x = x * scaleRatio;
    this._y = y * scaleRatio;
    this._xscale = this._yscale = 45 * scaleRatio;
    
    this._xscale *= Math.sin(angle);
    this.swapDepths(Math.round(-z));
};
// ===========================================================

// ===========================================================
// ATTACH OBJECTS
// ===========================================================
angleStep = 2*Math.PI/6;
for (i=0; i < 6; i++){
    attachedObj = theScene.attachMovie("pane", "pane"+i, i);
    attachedObj.angle = angleStep * i;
    attachedObj.radius = 400;
    attachedObj.x = Math.cos(attachedObj.angle) * attachedObj.radius;
    attachedObj.z = Math.sin(attachedObj.angle) * attachedObj.radius;
    attachedObj.y = 40;
    attachedObj.display = displayPane;
    objectsInScene.push(attachedObj);
}
// ===========================================================

// ===========================================================
// TRACK MOUSE
// ===========================================================
panCamera = function(){
    spin -= this._xmouse/1000;
    for (var i=0; i < objectsInScene.length; i++){
        objectsInScene*.display();
    }
};
theScene.onEnterFrame = panCamera;
// ===========================================================

```
