Heres the image pan code I’m using, thanks to Krilnon:
MovieClip.prototype.setDest = function(speed:Number):Void {
this.mousePercent = _xmouse/Stage.width;
this.destX = Math.round(-((this._width-Stage.width)*this.mousePercent));
this.onEnterFrame = function():Void {
(this._x == this.destX) ? delete this.onEnterFrame : this._x += Math.ceil((this.destX-this._x)*(speed/100));
};
};
onMouseMove = function ():Void {
bg_mc.setDest(5);
};
This code controls bg_mc only, I was wondering if it would be possible to control btn0 all the way to btn22 for this code? I want bt0~btn22 to be controlled as one object. Ive tried pushing them into an array & using that but that didnt work too well.
Heres what I tried:
allMCs = [];
MovieClip.prototype.setDest = function(speed:Number):Void {
this.mousePercent = _xmouse / Stage.width;
this.destX = Math.round(-((this._width - Stage.width) * this.mousePercent));
this.onEnterFrame = function():Void {
(this._x == this.destX) ? delete this.onEnterFrame : this._x += Math.ceil((this.destX - this._x) * (speed / 100));
};
};
onMouseMove = function ():Void {
for (i = 0; i <= 22; i++) {
allMCs* = ["btn" + i];
allMCs.setDest(5);
trace(allMCs);
}
};
Thanks.