Horizontal MC Scroll

Well, here’s the way ive set up my fla:
[AS]stageW = Stage.width;
stageH = Stage.height;
space = 5;
speed = 3;
holder_mc.loadMovie(“rocket.jpg”);
this.createEmptyMovieClip(“temp”, 100);
this.createEmptyMovieClip(“temp2”, 101);
temp.onEnterFrame = function() {
if (holder_mc._width>0) {
step = holder_mc._width/3;
mask_mc._x = stageW/2-step/2;
mask_mc._y = stageH/2-holder_mc._height/2;
mask_mc._width = step;
mask_mc._height = holder_mc._height;
holder_mc._x = mask_mc._x;
holder_mc._y = mask_mc._y;
start = mask_mc._x;
a = holder_mc._x-space;
b = holder_mc._y-space;
c = holder_mc._x+mask_mc._width+space;
d = holder_mc._y+holder_mc._height+space;
with (this) {
lineStyle(2, 0x333333, 100);
moveTo(a, b);
lineTo(c, b);
lineTo(c, d);
lineTo(a, d);
lineTo(a, b);
}
rew_btn._y = ff_btn._y=d+space;
rew_btn._x = a;
ff_btn._x = a+ff_btn._width+space;
delete this.onEnterFrame;
}
};
scroll = function () {
temp2.onEnterFrame = function() {
if (Math.abs((start-nstep)-holder_mc._x)<1) {
trace(“done”);
delete this.onEnterFrame;
} else {
trace(“scrolling”);
holder_mc._x += ((start-n
step)-holder_mc._x)/speed;
}
};
};
ff_btn.onPress = function() {
n>=2 ? n=2 : (n++, scroll());
};
rew_btn.onPress = function() {
n<=0 ? n=0 : (n–, scroll());
};
[/AS]

Im giving you a tip :wink:
Look how ive setup my functions and youll see that the onEnterFrame is only called when you press the buttons, and after its not necessary anymore, its deleted.

maybe something like this

_global.portfolioSection = function() {
	path = _root.sectionMC_03.folioClip;
	maxWidth = path.section_mc._width-529;
	velocity = 4;
	targetX = 527;
	path.section_mc.onEnterFrame = function() {
		if (Math.abs(targetX-this._x)<1) {
			trace("done");
			delete this.onEnterFrame;
		} else {
			trace("scrolling");
			this._x += (targetX-this._x)/velocity;
		}
	};
	// Forward Button
	path.forward_btn.onRelease = function() {
		if (targetX>-(maxWidth-370)) {
			targetX -= 370;
		}
	};
	// Back Button
	path.back_btn.onRelease = function() {
		if (targetX<527) {
			targetX += 370;
		}
	};
};

Hello All,

I finally got this thing working. If y’all could check it out, I have one final question having to do with this piece. Would there be a way to substitute an MC or a textlink in place of an element in the array? sometimes i might want to include more than just text.

[AS]

portfolioSection(["", “section1”, “section2”, “section3”, “section4”]);

[/AS]