PDA

View Full Version : Level Problem. Please take a look



tolgainam
April 7th, 2005, 10:59 AM
I have a code like this on the root.

MovieClip.prototype.scalebig = function(obj) {
_root[obj]._x = _root[obj].bigx;
_root[obj]._y = _root[obj].bigy;
_root[obj].onEnterFrame = function() {
diff = this.bigscale-_root[obj]._xscale;
_root[obj]._xscale = _root[obj]._yscale += diff/this.speed*0.3;
this.renkli._alpha +=10;
if(this.renkli._alpha >= 100) {
this.renkli._alpha = 100;
}
//trace(this.getDepth());
if (Math.abs(diff)<0.2) {
delete this.onEnterFrame;

}
};
};

When I call this form a first level object (I mean an object on the _root level)
it just works fine. But when I call this from an naother level it does not work.
Ex: _root.menu.
why

stringy
April 7th, 2005, 11:23 AM
I have a code like this on the root.

MovieClip.prototype.scalebig = function(obj) {
_root[obj]._x = _root[obj].bigx;
_root[obj]._y = _root[obj].bigy;
_root[obj].onEnterFrame = function() {
diff = this.bigscale-_root[obj]._xscale;
_root[obj]._xscale = _root[obj]._yscale += diff/this.speed*0.3;
this.renkli._alpha +=10;
if(this.renkli._alpha >= 100) {
this.renkli._alpha = 100;
}
//trace(this.getDepth());
if (Math.abs(diff)<0.2) {
delete this.onEnterFrame;

}
};
};

When I call this form a first level object (I mean an object on the _root level)
it just works fine. But when I call this from an naother level it does not work.
Ex: _root.menu.
why
try something like this

MovieClip.prototype.scalebig = function(bigx, bigy, bigscale, clip, speed) {
this.bigx = bigx;
this.bigy = bigy;
this.bigscale = bigscale;
this.speed = speed;
this._x = this.bigx;
this._y = this.bigy;
this.onEnterFrame = function() {
diff = this.bigscale-this._xscale;
this._xscale = this._yscale += diff/this.speed*0.3;
this[clip]._alpha += 10;
if (this[clip]._alpha>=100) {
this[clip]._alpha = 100;
}
//trace(this.getDepth());
if (Math.abs(diff)<0.2) {
delete this.onEnterFrame;
}
};
};

then, assuming you have a movieclip mc on _root


_root.mc.scalebig(200, 200, 200, "renkli", 10);
from any timeline.