aqui os pongo un ejemplo en el que estoy liado y me quedao atrancado por culpa de no entender el alcance de las rutas desde las clases, en este codigo vereis un onenterframe que se destruye en el momento que se carga una imagen, cuando se carga la imagen quiero llamar a la funcion createTxt() desde dentro del onEnterFrame,quiero saber como pero tmb el porque para entendeerlo y poder sacar las rutas por mi mismo un saludo y gracias
class icono2 {
private var _icoPathCreate:MovieClip;
private var icoMc:MovieClip;
private var icoMcImg:MovieClip;
private var icoMcTxt:MovieClip;
private var icoName:String;
private var icoDepth:String;
private var icoPosX:Number;
private var icoPosY:Number;
private var icoTxtLabel:String;
private var icoPathImg:String;
private var icoPathAply:String;
private var cargado:Number = 0;
function icono2(_icoPathCreate, icoName, icoPosX, icoPosY, icoTxtLabel, icoPathImg, icoPathAply) {
this._icoPathCreate = _icoPathCreate;
this.icoName = icoName;
this.icoDepth = icoDepth;
this.icoPosX = icoPosX;
this.icoPosY = icoPosY;
this.icoTxtLabel = icoTxtLabel;
this.icoPathImg = icoPathImg;
this.icoPathAply;
this._icoPathCreate.createEmptyMovieClip(this.icoName, this._icoPathCreate.getNextHighestDepth());
this.icoMc = this._icoPathCreate[this.icoName];
this.icoMc.createEmptyMovieClip("icoMcVisorImg", this.icoMc.getNextHighestDepth());
this.icoMc._visible = false;
this.icoMcImg = this.icoMc["icoMcVisorImg"];
this.icoMc.thisObjectPath = this; //<<-- esta cosa ya me costo de comprender -_- this.icoMcImg.loadMovie(this.icoPathImg);
this.icoMc.onEnterFrame = function() {
this.cargado = (this.thisObjectPath.icoMcImg.getBytesLoaded()*100)/(this.thisObjectPath.icoMcImg.getBytesTotal());
if (this.cargado>=100) {
this.thisObjectPath.icoMc._visible = true;
this.thisObjectPath.createTxt(); //<< desde aqui quiero ejecutar la funcion createTxt();
//y se que se puede hacer asi pero solo si la funcion se encuentra fuera del contructor
//yo quiero poder ejecutar dicha funcion dentro de la funcion constructora. delete this.onEnterFrame;
}
};
//End onEnterFrame
function createTxt() {
trace(this);
trace("funcion activada");
var txtPosX = -13;
var txtPosY = 0+this.icoMcImg._height;
var txtWidth = this.icoMcImg._width+26;
var txtHeight = 34;
this.icoMc.createTextField("icoTxtLabel", this.icoMc.getNextHighestDepth(), txtPosX, txtPosY, txtWidth, txtHeight);
this.icoMcTxt = this.icoMc["icoTxtLabel"];
with (this.icoMcTxt) {
multiline = true;
wordWrap = true;
border = false;
autoSize = true;
type = "input";
myformat = new TextFormat();
myformat.color = 0xCCCCCC;
myformat.bullet = false;
myformat.align = "center";
myformat.underline = false;
myformat.size = 10;
myformat.font = _serif;
myformat.bold = false;
borderColor = 0xCCCCCC;
text = this.icoTxtLabel;
setTextFormat(myformat);
}
}
//End createTxt
}
//End function icono2 (constructor)
}
