there is a code that will reposition to the center of stage when window is maximized etc. problem is i dont know how to incorporate into the gallery.
please someone look at the code and please help!
mainListener = new Object();
mainListener.onResize = function() {
_root.containerMC.pos = [Stage.width/2-_root.containerMC._width/2, Stage.height/2-_root.containerMC._height/2];
};
Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.addListener(mainListener);
_root.containerMC.onEnterFrame = function() {
this._x += (this.pos[0]-this._x)/6;
this._y += (this.pos[1]-this._y)/6;
border._x = this._x;
border._y = this._y;
};
you can see my full code here, it is working but it stops and then nothing, and it wont reposition right away to the center… and border is not moving with it…
please help!!!
spacing = 10;
containerMC._alpha = 0;
MovieClip.prototype.loadPic = function(pic) {
_root.containerMC._alpha = 0;
this.loadMovie(pic);
_root.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
if (t != 0 && Math.round(l/t) == 1) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
mainListener = new Object();
mainListener.onResize = function() {
_root.containerMC.pos = [Stage.width/2-_root.containerMC._width/2, Stage.height/2-_root.containerMC._height/2];
};
Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.addListener(mainListener);
_root.containerMC.onEnterFrame = function() {
this._x += (this.pos[0]-this._x)/6;
this._y += (this.pos[1]-this._y)/6;
border._x = this._x;
border._y = this._y;
};
border.resizeMe(w, h);
delete _root.onEnterFrame;
}
};
};
MovieClip.prototype.resizeMe = function(w, h) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
if (Math.abs(this._width-w)<1) {
this._width = w;
this._height = h;
_root.containerMC._x = this._x-this._width/2+spacing/2;
_root.containerMC._y = this._y-this._height/2+spacing/2;
_root.containerMC._alpha += 5;
if (_root.containerMC._alpha>90) {
_root.containerMC._alpha = 100;
delete this.onEnterFrame;
}
}
};
};
=) thanks