Para facilitar mas las cosas .... les dejo aqui el codigo completo .... al
final area es un MC que contiene un cuadrado y una campo de texto dinamico.
/* --------------------------------------------
/* LOCALIZADOR
/* --------------------------------------------
/* Clase que hereda de MC. Ser� el destino
/* para los distintos items que se considere
/* S�lo podr� tener un item activo
/* Se ha definido como componente.
/**********************************************/
function localizador () {
// Propiedad definida en el panel de control
// localizador es un componente y tiene
// varios items asociados
////this.localizadorFor = new Array()
this.addProperty ("actualItem", this.getActualItem, this.setSetActualItem);
// Propiedad privada que contiene una
// referencia al item que est� posicionado
// en localizador
this.__actualItem__ = null;
this.init.call(this);
}
localizador.prototype = new MovieClip();
localizador.prototype.init = function() {
// Creamos una nueva referencia a este localizador
// en todos los items que tiene asociados a trav�s
// del panel de propiedades
var i = int(this.localizadorFor.length);
while(i--) {
eval(this.localizadorFor[i]).localizador = this;
}
}
localizador.prototype.setActualItem = function(item) {
// Al item que estaba activo lo hacemos volver
// a su posici�n inicial
this.__actualItem__.volver.call(this.__actualItem__);
// seteamos el nuevo item activo
this.__actualItem__ = item;
// Al nuevo item activo lo reposicionamos
this.__actualItem__.mostrar.call(this.__actualItem__);
}
localizador.prototype.getActualItem = function() {
return this.__actualItem__;
}
/* --------------------------------------------
/* AREA
/* --------------------------------------------
/* Clase que hereda de MC. Mostrara los datos
/* de la zona seleccionada
/**********************************************/
function area() {
this.init(0);
this.init.call(this);
}
area.prototype = new MovieClip();
area.prototype.init = function(vista) {
this._visible = vista;
}
/* --------------------------------------------
/* ITEM
/* --------------------------------------------
/* Clasee que hereda de MovieClip.
/* Se encarga de saber d�nde se tiene que
/* posicionar en todo momento
/**********************************************/
function item() {
// Almacenamos las coordenadas iniciales
this.initX = this._x;
this.initY = this._y;
//Par�metros ecuaciones ease Penner
this.t = new Number();
this.NFrames = new Number();
}
item.prototype = new MovieClip();
// Seteamos los par�metros
// para que el item se mueva desde
// su posici�n inicial hasta la posici�n
// de su localizador
item.prototype.mostrar = function() {
delete this.onEnterFrame;
this.t = 0;
this.NFrames = 15;
this.endX = int(this.localizador._x);
this.endY = int(this.localizador._y);
this.dy = -(this._y - this.endY);
this.dx = -(this._x - this.endX);
this.y = this._y;
this.x = this._x;
this.sx = 300;
this.sy = 300;
this.reposition();
}
// Idem que mostrar() pero al rev�s
item.prototype.volver = function() {
delete this.onEnterFrame;
this.t = 0;
this.NFrames = 15;
this.dy = -(this._y - this.initY);
this.dx = -(this._x - this.initX);
this.y = this._y;
this.x = this._x;
this.sx = 70;
this.sy = 70;
this.reposition();
}
item.prototype.reposition = function() {
this.onEnterFrame = effects.easeReposition;
}
item.prototype.onRelease = function() {
this.localizador.setActualItem(this);
}
item.prototype.onRollOver = function() {
//this.area.init(1);
if(this._xscale > 200) {
trace("");
#aki necesito acceder a los metodos de area y al campo de texto dinamico
}
}
/* --------------------------------------------
/* EFFECTS
/* --------------------------------------------
/* Clase est�tica con m�todos para gestionar
/* las ecuaciones de movimiento.
/* NOTE: los distintos m�todos se invocan
/* en el �mbito de la instancia que los llama
/**********************************************/
function effects() {
}
effects.easeReposition = function() {
if (this.t++ < this.NFrames) {
this._y = Math.easeOutQuart (this.t, this.y, this.dy, this.NFRAMES);
this._x = Math.easeOutQuart (this.t, this.x, this.dx, this.NFRAMES);
this._xscale += (this.sx - this._xscale)/4;
this._yscale += (this.sy - this._yscale)/4;
} else {
this.t = 0;
delete this.onEnterFrame;
}
}
// Ease Equation tomada de robertPenner
// www.robertPenner.com
Math.easeOutQuart = function (t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
};
// Registramos las clases
Object.registerClass("localizador_MC",localizador);
Object.registerClass("area", area);
Object.registerClass("galicia",item);
Object.registerClass("galicia2",item);
Esperemos que al final salga xD
----- Original Message -----
From: "Ivan Rodriguez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 04, 2003 4:16 PM
Subject: [ASNativos] Como acceder a una funcion .... y a las variables
> Buenas, aqui estoy de nuevo :-)
>
> Mi pregunta es ... e creado un componente, para ello cree un Movie Clip
con un cuadrado y una caja de texto dinamico, y lo converti a componente, le
a�adi una variable de nombre texto, y quisiera rellenar esa casilla de texto
via AS, tengo el siguiente codigo asociado para ese Componente:
>
> /* --------------------------------------------
> /* AREA
> /* --------------------------------------------
> /* Clase que hereda de MC. Mostrara los datos
> /* de la zona seleccionada
> /**********************************************/
> function area() {
> this.init(0);
> }
>
> area.prototype = new MovieClip();
>
> area.prototype.init = function(vista) {
> this._visible = vista;
> }
>
> Object.registerClass("area", area);
>
> Quiero hacer uso de la funcion init() en este codigo:
>
> item.prototype.onRollOver = function() {
> //trace(this._xscale);
> if(this._xscale > 200) {
> //trace(this._xscale);
> area.init(1); //aki no funciona :-(
> }
> }
>
> Como accedo a ese metodo?�
>
> Y como puedo acceder al campo de texto dinamico desde ese mismo punto�?�
>
> Muchas gracias :-D
>
>
> Iv�n Rodriguez Espada
> _________________________
> ALAPLAYA.COM
> http://www.alaplaya.com
> [EMAIL PROTECTED]
> <!-------------------------------
> Lista ASNativos:
> subscripciones/desubscripciones
> http://www.sidedev.net/asnativos
> -------------------------------->
>
<!-------------------------------
Lista ASNativos:
subscripciones/desubscripciones
http://www.sidedev.net/asnativos
-------------------------------->