Up&Down MC scroll buttons

Ok i searched the board and couldn’t find any threads on this. I need a set of buttons that will scroll a MC up and down when the mouse is clicked and held like a normal scroll button. The only MC scrolling tuts i can find use a drag bar, this is not an option. Any body know how to code this?

ok what i do in this case is make a mask over the mc and have a mc as a btn that controls the _y pos of the movie clip on a press event it doesnt have a scroller because i havent tried doing it that way

Ok, I will give this a quick shot, untested, but should work.

Create the scrolling movie clip symbol. Hmm, call it “myClip” I guess (for this situation I will use that instance name).

Now I used movie clips for buttons for this (well… in my head) so I don’t think regular button symbols will work for this.

So create your movie symbol buttons. Give one the instance name of “up” and the other the instance name of “down”

Now on a frame apply these actions…

[AS]var speed = 5;
var howFarUp = 0;
var howFarDown = 150;
function moveUp() {
this.onEnterFrame = function() {
myClip._y -= speed;
if (myClip._y<=howFarUp) {
delete this.onEnterFrame;
}
};
}
function moveDown() {
this.onEnterFrame = function() {
myClip._y += speed;
if (myClip._y>=howFarDown) {
delete this.onEnterFrame;
}
};
}
function clearEnterFrame() {
delete this.onEnterFrame;
}
up.onPress = moveUp;
up.onRelease = clearEnterFrame;
down.onPress = moveDown;
down.onRelease = clearenterFrame;[/AS]

speed is how fast you want the scroll
howFarUp is the _y coordinate that the clip can scroll UP to (using the up button)
howFarDown is the _y coordinate the clip can scroll DOWN to (using the down button)

Huge man huge. I will get to testing this right away. i have to get u a gift or something. You always show me the way to go. Thanks LIB

No problem, I wouldn’t be surprised if I screwed something up with that. Thinking out an entire code in my head at 2:30am is never good :stuck_out_tongue:

But it shouldn’t be too hard to fix if there is something wrong :-\ I hope :stuck_out_tongue:

Goodluck, and Goodnight :slight_smile:

oh man lost!

this is just incredible. I tested it myself and it 100% works! I’ve
also been wanting this sort of thing with no luck…until now!

Man-oh-man this is SO HUGE, you have no idea. You are def THE MAN! :beam:

nice work as usual.

Huge man so Huge. My new site has a tut section and i would love to add this to it with your help. YOu would be full ycredited of course and a like to your site would be beside it.

Hmm, interesting. I tested it just now… and my scrolling seems backwards :stuck_out_tongue: Up scrolls down and Down scrolls up…hahahaha.

Alright… well I did another quick scroller thing again. This time you can use it on either MovieClip buttons OR Button symbols :slight_smile:

And it scrolls in the right direction. And it fixes the bug in my last script where when it reached the howFarUp or howFarDown if you kept clicking the button it would still keep moving pixel by pixel :stuck_out_tongue:

Check my attachment for my fully commented .fla file :slight_smile:

unbelievable lost. i’m stunned at you, as always. :beam:

Amazing man. you are the best:)

Glad you guys like :slight_smile:

WHOA!!! WHAT THE $#&^… Im not a pixel person? How the heck could that have happened? Im a mod, Im a member, I contribute… (Waaaaaaaaaaaaaaaaaaaaaaaaahhaha…BOOOOOOOoo)<SOB>
:frowning:

Montoya: We all made our own Pixel People :stuck_out_tongue:

c’mon man, let me have a little phun with this! I’ve never made a pixel person before. How’d you do that?

Lost… you’re not as cheerie as I remember you. Whassup brotha?

Hmm, is it really that noticeable :frowning: Hrmm… I guess I hide it better in real life :-\ :*( Just got a lot goin’ on here.

As for making pixel people. I used Photoshop, just goto Window/Document/New Window to create two windows of the same document. In one window zoom ALL the way in… then take the 1px pencil tool and start clicking pixel by pixel to create your pixel person :slight_smile: You will be able to refer back to your normal sized window on what it looks like instead of zooming in and out all the time.

You can submit your character to this thread when you are done and it will be added :slight_smile:

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=18695

Oh yeah, there is also a template you can use to help you design your pixel person if you don’t know how… just save Sintaxs’ and work off of that… thats what I did :stuck_out_tongue:

Hang in there, Lost. If I told you my story, you would cheer up.

actually, in photoshop, the conventional way to view zoomed in and overall views is by using the navigator window. Just make it really large. (Less memory, more flexible, etc… (I just PS quite a bit, just never used it for Pixel People. Thanks for the tip, Pal…

Well it depends on what your story is :stuck_out_tongue: If your story is happy, then maybe it would, but if your story is not happy, then it won’t… :wink:

I never use the navigator window, I dunno, I just don’t really like it that much, I am more comfortable with the two window method I guess :-\ It’s worked well for me so far :slight_smile:

I can’t wait to see your Pixel Person, I am sure it will be rockin’ :beam:

Usefull thread this, nice LIB - your download is nicely annotated.

two questions I would really appreciate an answer on


var howFarDown = 10-(myClip._height/2);

Why is it /2? wouldn’t 10-(myClip._height); be sufficient?

Secondly, the “prototype”, I looked in help but its all in Jargen… I don’t really understand what its all about…??

if you could help me understand those 2 bits I would be really greatful!

Well it all depends on where the registration point is located, and the size of the clip.

In my case I made the registration point at the Top-Center of the mc that I use to scroll. And I made the height of the clip twice the height of the mask.

So… since the top of the mask is located at _y=10, I need to take that point and subtract the height of the clip… but divide it in half since the clip is twice the height of the mask.

As for prototypes… I learned prototypes from here…

http://www.kirupa.com/developer/actionscript/tricks/prototypes.asp

If anyone knows any better tutorials on it… please post it, but the above was more than enough for me :slight_smile:

k, I c.

ty.

(^ nice eh, not 1 word used :bandit: )