Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrolling a CLIP 1

Status
Not open for further replies.

Firehawk734

Technical User
Jan 22, 2002
155
US
How the heck do you scroll a clip??

Can someone give me a tutorial how to start from scratch on scrolling a clip?? I need to scroll buttons.

Thx, preciate it
 
Scrolling the contents of a text box or scrolling an actual graphic image?
 
Well if you want to scroll a graphic around the screen you need to alter its _y coordinate (where it is heightwise on screen).

This only works for movieclips so select your button, hit f8, name it and turn it into a movieclip (the default option).

Then click on the clip to select it and paste this into the actions panel...

onClipEvent(enterFrame){
if(_y>20){
_y--;
}

Which, if you place your clip at the bottom of the screen) will zoom it up to the top as soon as the movie starts.

I'm a bit confused as to why you want to scroll the buttons themselves, usually you'd use a static button to control the up/down scroll of another object...
 
WHy are you confused??

I want to put a list of buttons in a clip to scroll as a menu kinda thing.

2advanced.com demonstrates this clearly. I am not sure that the help u have provided is exactly what i want.
 
I'm confused because you said you wanted to "scroll buttons" - which is why I asked if you wanted to scroll the content of a textbox using buttons as a control rather than move the buttons themselves which would be weird. Excuse me for seeking clarification...

If you need to scroll the contents of a textbox (which is what's happening on the 2A site) you need to create a dynamic textbox on the stage and give its variable a value ("text" is easy). Then add one of these scripts to each button to control the scrolling:

on(release){
text.scroll++;
}

on(release) {
text.scroll--;
}

And set "text" to whatever text you want displayed in the textbox.

 
Alright wangbar,

Thanks very much, i was the one really confused. I thought u meant i wanted to take a whole graphic and move it up and down.

I didnt mean to jump on ya, Im jus like that hehe.
 
Kinda like that dave, but not really. I want to have it appear like as if u were going to scroll text u know?? but its a list of buttons that u are scrolling up and down,

as in 2advanced.com . Thanks for the help very much. If anyone can direct me to a tutorial on how to start from scratch to make the scrolling part for "buttons" I would really appreciate it.
 
Of what "scrollable buttons" list are you talking about exactly on 2advance.com? Updates?
 
exploratory, accolades, portfolio

They are all the same.
 
Ok, got you now.

Could be done a couple of ways but here's a solution...


Here's the code that did the scrolling...

Code:
onClipEvent (load) {
	// names for buttons
	labels = new Array("portfolio", "contact", "showcase", "details", "profiles", "services", "accolades", "exploratory", "umm...", "that's it");
	// create buttons
	for (i=0; i<10; i++) {
		duplicateMovieClip (_root.optionClip, &quot;option&quot;+i, i);
		clip = _root[&quot;option&quot;+i];
		clip.label = labels[i];
		clip._x = 100;
		clip._y = 100+(i*clip._height);
	}
}
onClipEvent (enterFrame) {
	// scroll up
	if (_root.up & !top) {
		for (i=0; i<10; i++) {
			_root[&quot;option&quot;+i]._y--;
			if (_root[&quot;option0&quot;]._y<=-20) {
				top = true;
			}
		}
		// scroll down
	} else if (_root.down & !bottom) {
		for (i=0; i<10; i++) {
			_root[&quot;option&quot;+i]._y++;
			if (_root[&quot;option0&quot;]._y>=100) {
				bottom = true;
			}
		}
	}
}

The menu is made up of separate clips (all duplicates of a master with a text box set to &quot;label&quot;). A loop controls the position of these clips depending on whether the up or down flags (set by the arrow buttons) are true or false.

There's a bunch of hardwired numbers in there which would be variables in a real application but hey, it's late here...
 
Needs this too...

if (_root[&quot;option0&quot;]._y<=-20) {
top = true;
} else {top=false;}

...likewise for the scroll down part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top