:asian: Hi masters! I have a problem, i tried to add a code to show a info window to each option of the array but i could not. I understand all code but i don´t know how to add that new code. Check the code. Thanks.
/*************************** FIRST FRAME ***********************/
// register root as environment
Object.environment = this;
// create camera object
this.cam = {x:0, y:0, z:500, dx:0, dy:0, dz:-500};
// set environmental constants
this.fl = 1000;
// create ‘space’ to which all words will be attached
this.createEmptyMovieClip(“space”, 1);
//this.createEmptyMovieClip(“window”, 1);
// center ‘space’ on the stage
space._x = 380;
space._y = 250;
// a string of words related to the wind
_root.somewords = “Xcaret+Delphinus+Dady’O+O Ultra Lounge+Garrafon+All Tournative+Bromelias de Xcaret”;
// convert the string of words into an array of words
_root.wordList = new Array();
//this.listaEtiquetas = new Array();
_root.wordList = this.somewords.split("+");
//this.listaEtiquetas = this.etiquetas.split("+");
// create one instance for each word in the list
for (n=0; n<this.wordList.length; n++) {
// pick a word from the list
var word = Object.environment.wordList[n];
var x = random(600)-380;
var y = random(337)-250;
var z = random(Object.environment.fl*2)-Object.environment.fl;
// create an instance of the SpaceWord object
nombre = “word”+String(depth++);
initialization = {txtword:word, x:x, y:y, z:z};
space.attachMovie(“spaceWord”, nombre, depth, initialization);
}
this.onEnterFrame = function() {
this.cam.dz += .5;
// move the camera to its destination
this.cam.x += (this.cam.dx-this.cam.x)/10;
this.cam.y += (this.cam.dy-this.cam.y)/10;
this.cam.z += (this.cam.dz-this.cam.z)/30;
};
stop();
/MCLIP********/
#initclip
// constructor
function SpaceWord() {
// set up button functionality
this.btnSquare.onPress = function() {
/**************************************************************/
//TEST CODE
//Starting x & y values
var xPos = Stage.height/2;
var yPos = Stage.height/2;
//attach the container clip
attachMovie("ventana", "new", i, {_x:xPos, _y:yPos});
//increase the y postion each time
//yPos += this["new"+i]._height+5;
//add the information
this["new"].name.text =trace( _root.wordList[0]);
/****************************************************************/
// push the camera towards the word by setting destination just a bit in front
Object.environment.cam.dx = this._parent.x;
Object.environment.cam.dy = this._parent.y;
Object.environment.cam.dz = this._parent.z+Object.environment.fl*.9;
// disable and hide button
this.enabled = false;
this._visible = false;
};
// set continual function to render word
this.onEnterFrame = this.render;
}
// allow SpaceWord to inherit MovieClip properties
SpaceWord.prototype = new MovieClip();
// instance methods
SpaceWord.prototype.render = function() {
var zActual = Object.environment.fl+this.z-Object.environment.cam.z;
// has the object moved behind the camera?
if (zActual>0) {
// object is still visible
// calculate scale
var scale = Object.environment.fl/zActual;
// set position using camera as an offset
this._x = (this.x-Object.environment.cam.x)scale;
this._y = (this.y-Object.environment.cam.y)scale;
// set size
this._xscale = scale100;
this._yscale = scale100;
// set fog
this._alpha = 100-99zActual/Object.environment.fl.5;
} else {
// object has moved behind camera
// reposition further down the line
this.z += Object.environment.fl*2;
// enable button
this.btnSquare.enabled = true;
this.btnSquare._visible = true;
}
};
SpaceWord.prototype.setWord = function(s) {
this.txtWord = s;
};
SpaceWord.prototype.setPosition = function(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
// Connect the class with the linkage ID for this movie clip
Object.registerClass(“spaceWord”, SpaceWord);
#endinitclip