# Tint not working in 3d?

**URL:** <https://forum.kirupa.com/t/tint-not-working-in-3d/266514>\
**Category:** flash\
**Created:** [July 21, 2008, 6:15pm UTC](https://forum.kirupa.com/t/tint-not-working-in-3d/266514 "2008-07-21T18:15:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![orangebychoice](https://avatars.discourse-cdn.com/v4/letter/o/73ab20/32.png) [@orangebychoice](https://forum.kirupa.com/u/orangebychoice)\
**Post date:** [July 21, 2008, 6:15pm UTC](https://forum.kirupa.com/t/tint-not-working-in-3d/266514/1 "2008-07-21T18:15:09Z")

</div>

Using one of the 3d tutorials here, I started making a really cool 3d interface to navagate around a scene. You use the red and green squares to navagate through a city scene. Get the source here [http://www.orangebychoice.com/flash/3d\_nav\_seven.fla](http://www.orangebychoice.com/flash/3d_nav_seven.fla) . For some crazy reason the code for the “setTransform” isn’t working for crap! I want each scene to fade to brown when it’s in the background and black in the forground. This is for a project at work and I’m freaking out!

Thank you for any insite!

Here the code, the problem is right in the middle, I commented it as “this isn’t working”…

> 

this.createEmptyMovieClip(“theScene”, 1);  
theScene.\_x = 300;  
theScene.\_y = 150;  
currentStage = 1;

theScene.depth = 1; // variable to control depth placement

// defines function to set the target of the cameraView  
// when you select the star (onPress)  
selectObjectBoxA = function(){  
cameraView.target.x = attachedObjBoxA.x;  
cameraView.target.y = attachedObjBoxA.y;  
cameraView.target.z = attachedObjBoxA.z;  
}  
selectObjectBoxB = function(){  
cameraView.target.x = attachedObjBoxB.x;  
cameraView.target.y = attachedObjBoxB.y;  
cameraView.target.z = attachedObjBoxB.z;  
}  
selectObjectBoxC = function(){  
cameraView.target.x = attachedObjBoxC.x;  
cameraView.target.y = attachedObjBoxC.y;  
cameraView.target.z = attachedObjBoxC.z;  
}

// this is the function for displaying the object onscreen  
displayObjectBoxA = function(cameraView, focalLength){  
var x = this.x - cameraView.x;  
var y = this.y - cameraView.y;  
var z = this.z - cameraView.z;  
if (z \< -400){  
this.\_visible = false;  
}else{  
this.\_visible = true;  
}  
var scaleRatio = focalLength/(focalLength + z);  
this.\_x = x \* scaleRatio;  
this.\_y = y \* scaleRatio;  
this.\_xscale = this.\_yscale = 100 \* scaleRatio;  
this.swapDepths(Math.round(-z));  
};  
displayObjectBoxB = function(cameraView, focalLength){  
var x = this.x - cameraView.x;  
var y = this.y - cameraView.y;  
var z = this.z - cameraView.z;

if (z \< -400){  
this.\_visible = false;  
}else{  
this.\_visible = true;  
}  
var scaleRatio = focalLength/(focalLength + z);  
this.\_x = x \* scaleRatio;  
this.\_y = y \* scaleRatio;  
this.\_xscale = this.\_yscale = 100 \* scaleRatio;  
this.swapDepths(Math.round(-z));  
};  
displayObjectBoxC = function(cameraView, focalLength){  
var x = this.x - cameraView.x;  
var y = this.y - cameraView.y;  
var z = this.z - cameraView.z;  
if (z \< -400){  
this.\_visible = false;  
}else{

//this isn’t working  
var myColorTransform = {rb: 225, gb: 10, bb: 10};  
this.setTransform(myColorTransform);

this.\_visible = true;  
}

var scaleRatio = focalLength/(focalLength + z);  
this.\_x = x \* scaleRatio;  
this.\_y = y \* scaleRatio;  
this.\_xscale = this.\_yscale = 100 \* scaleRatio;  
this.swapDepths(Math.round(-z));  
};  
displayObjectElse = function(cameraView, focalLength){  
var x = this.x - cameraView.x;  
var y = this.y - cameraView.y;  
var z = this.z - cameraView.z;

if (z \< -400){  
this.\_visible = false;  
}else{  
this.\_visible = true;  
}

var scaleRatio = focalLength/(focalLength + z);  
this.\_x = x \* scaleRatio;  
this.\_y = y \* scaleRatio;  
this.\_xscale = this.\_yscale = 100 \* scaleRatio;  
this.swapDepths(Math.round(-z));  
};

// define array to hold the objects in the scene  
objectsInScene = new Array();

// abox assign objects to scene and move camera on click  
attachedObjBoxA = theScene.attachMovie(“boxA”, “boxA”+i, theScene.depth++);  
attachedObjBoxA.x = -200;  
attachedObjBoxA.y = 0;  
attachedObjBoxA.z = -100;  
attachedObjBoxA.display = displayObjectBoxA;  
objectsInScene.push(attachedObjBoxA);  
// aBox back button  
attachedObjABackBtn = theScene.attachMovie(“aBackBtn”, “aBackBtn”+i, theScene.depth++);  
attachedObjABackBtn.x = attachedObjBoxA.x - 65;  
attachedObjABackBtn.y = attachedObjBoxA.y - 65;  
attachedObjABackBtn.z = attachedObjBoxA.z -50;  
attachedObjABackBtn.onPress = selectObjectBoxC;  
attachedObjABackBtn.display = displayObjectBoxC;  
objectsInScene.push(attachedObjABackBtn);  
// aBox forward button  
attachedObjAForwardBtn = theScene.attachMovie(“aForwardBtn”, “aForwardBtn”+i, theScene.depth++);  
attachedObjAForwardBtn.x = attachedObjBoxA.x + 30;  
attachedObjAForwardBtn.y = attachedObjBoxA.y - 65;  
attachedObjAForwardBtn.z = attachedObjBoxA.z -50;  
attachedObjAForwardBtn.onPress = selectObjectBoxB;  
attachedObjAForwardBtn.display = displayObjectBoxB;  
objectsInScene.push(attachedObjAForwardBtn);

//for the boxB  
attachedObjBoxB = theScene.attachMovie(“boxB”, “boxB”+i, theScene.depth++);  
attachedObjBoxB.x = 300;  
attachedObjBoxB.z = 200;  
attachedObjBoxB.y = 0;  
attachedObjBoxB.display = displayObjectBoxB;  
objectsInScene.push(attachedObjBoxB);  
// boxB back button  
attachedObjBBackBtn = theScene.attachMovie(“bBackBtn”, “bBackBtn”+i, theScene.depth++);  
attachedObjBBackBtn.x = attachedObjBoxB.x - 65;  
attachedObjBBackBtn.y = attachedObjBoxB.y - 65;  
attachedObjBBackBtn.z = attachedObjBoxB.z -50;  
attachedObjBBackBtn.onPress = selectObjectBoxA;  
attachedObjBBackBtn.display = displayObjectBoxA;  
objectsInScene.push(attachedObjBBackBtn);  
// boxB forward button  
attachedObjBForwardBtn = theScene.attachMovie(“bForwardBtn”, “bForwardBtn”+i, theScene.depth++);  
attachedObjBForwardBtn.x = attachedObjBoxB.x + 30;  
attachedObjBForwardBtn.y = attachedObjBoxB.y - 65;  
attachedObjBForwardBtn.z = attachedObjBoxB.z -50;  
attachedObjBForwardBtn.onPress = selectObjectBoxC;  
attachedObjBForwardBtn.display = displayObjectBoxC;  
objectsInScene.push(attachedObjBForwardBtn);

//boxC crap…  
attachedObjBoxC = theScene.attachMovie(“boxC”, “boxC”+i, theScene.depth++);  
attachedObjBoxC.x = -500;  
attachedObjBoxC.y = 0;  
attachedObjBoxC.z = 1000;  
attachedObjBoxC.display = displayObjectBoxC;  
objectsInScene.push(attachedObjBoxC);  
// cBox back button  
attachedObjCBackBtn = theScene.attachMovie(“cBackBtn”, “cBackBtn”+i, theScene.depth++);  
attachedObjCBackBtn.x = attachedObjBoxC.x - 65;  
attachedObjCBackBtn.y = attachedObjBoxC.y - 65;  
attachedObjCBackBtn.z = attachedObjBoxC.z -50;  
attachedObjCBackBtn.onPress = selectObjectBoxB;  
attachedObjCBackBtn.display = displayObjectBoxB;  
objectsInScene.push(attachedObjCBackBtn);  
// cBox forward button  
attachedObjCForwardBtn = theScene.attachMovie(“cForwardBtn”, “cForwardBtn”+i, theScene.depth++);  
attachedObjCForwardBtn.x = attachedObjBoxC.x + 30;  
attachedObjCForwardBtn.y = attachedObjBoxC.y - 65;  
attachedObjCForwardBtn.z = attachedObjBoxC.z -50;  
attachedObjCForwardBtn.onPress = selectObjectBoxA;  
attachedObjCForwardBtn.display = displayObjectBoxA;  
objectsInScene.push(attachedObjCForwardBtn);  
//extra objects on the stage  
//citySillo Data…  
attachedObjCityS = theScene.attachMovie(“citySillo”, “citySillo”+i, theScene.depth++);  
attachedObjCityS.x = 500;  
attachedObjCityS.y = 0;  
attachedObjCityS.z = 10000;  
attachedObjCityS.display = displayObjectElse;  
objectsInScene.push(attachedObjCityS);

// now make a camera object to serve as the users view or camera  
// position within the cockpit of the car  
cameraView = new Object();  
cameraView.x = 0;  
cameraView.y = 0;  
cameraView.z = 0;  
// set a target object in the cameraView to represent the positions  
// the camera is easing to in its movement  
cameraView.target = new Object();  
cameraView.target.x = 0;  
cameraView.target.y = 0;  
cameraView.target.z = -500;

// define focal length  
focalLength = 400;

// function controlling the camera ease and all displaying  
// for objects in the objectsInScene array  
easeToTarget = function(){

// ease each camera point to its target point  
cameraView.x += (cameraView.target.x - cameraView.x)/10;  
cameraView.y += (cameraView.target.y - cameraView.y)/10;  
cameraView.z += (cameraView.target.z - cameraView.z)/10;

// run the display function for each object in objectsInScene array  
for (var i=0; i\<objectsInScene.length; i++){  
objectsInScene\*.display(cameraView, focalLength);  
}  
};  
theScene.onEnterFrame = easeToTarget;
