Groups » Flash Maniacs » Topics » [T]Custom Scroll Bar

Listing 1-15 of 18    1   2   of  2 Next >
Author Message
Flash Mod

M/22
,
Instant Message
Send Message
Reply with this quote Reply to this Post Posted:  Mar 16, 2007 7:17 AM
This tutorial will allow you to create a completely customized scroll bar and allow for any items (ie.movie clips, buttons, pictures, etc) to be scrollable, not just text.

To start. Gather all the content you want to be scrollable and place all of it into on big movie clip. In this example I have static text, bitmap, a button and a movie clip. Give this movie clip an instance name.
I called this movie clip content_mc. Besure to place all of the content originated at X:0 Y:0 otherwise you will get some somewhat off results in the scrolling.

Now create your buttons. I made to very simple buttons with an up and a down arrow on them.

Ex:
(Can't post an image thumb nail because myspace is being crap right now) Click Here

Make each button into a seperate movie clip or button, which ever you prefer.

Give the up button an instance name of
up_mc (or up_btn if you made it a button)
and the down button an instance name of
down_mc (or down_btn if you made it a button).

Now we are done with the designing part of the tutorial. Now comes the fun part...

Action Script:

Create at an actions layer and in the first frame hit F9 to open up your actions panel.

down_btn.onPress = function () {
if(content_mc._y >= -226){
content_mc._y -= 15;
}
}

up_btn.onPress = function () {
if (content_mc._y <= 74){
content_mc._y += 15;
}
}


You want to create an onPress event for the buttons you created. Then we need to create an if statement inside a function.

You may want to get a pen and paper for this part unless you have a good memory.

Click on the content movie clip and put it at its position it would be in where it would be at the top of the view able area.
Now go to the properties panel and get the Y value for the movie clip. In this example, the Y value of the movie clip is 74px.

Now take the movie clip and place it as far up as you want it to be able to scroll. Once again, in the properties panel, get the Y value or the movie clip again. This time we have -226px for out Y value.

Return the movie clip to its original position at the top most part of the scrollable area.

Back to our action script...
For the down button
we want to say that if the _y value of the movie clip is greater than or equal to >= the second value your wrote down (or remembered) then we will
will change the _yvalue of the movie clip by moving it up + 15px.

now for the up button.
we want to say that if the _y value of the movie clip is less than or equal to <= the first value your wrote down (or remembered) then we will
will change the _yvalue of the movie clip by moving it down - 15px.

Thats all there is to it!

If you want to move the movie clip more/less spaces on each click of the button then incease/decrease (15)the amount of pixels.

If you end up having the problem that the movie clip is moving in the opposite direction that you want it to when a button is pressed then you most likely just need to switch the + and - signs in the functions.

If you want to make your content only viewable in a certain part of your stage then just place a mask over the content_mc movie clip with the area you want people to see.

Thank you for reading this tutorial. I hope you find it very helpful with your flash animations. For any help with this tutorial or questions, please post only in this forum thread.

scrollableContent.fla

~Flash Mods
Hellcat

Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: May 9, 2007 8:19 PM
is it possible to do this without putting all of the content in a movieclip?

for example, i want everything to scroll, not just certain content. so the whole thing moves across. as if i had a div on a page and it had a scrollbar, the whole profile would move. thats what im after.
mike


M/23
Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: May 9, 2007 8:26 PM
Hellcat wrote:
is it possible to do this without putting all of the content in a movieclip?

for example, i want everything to scroll, not just certain content. so the whole thing moves across. as if i had a div on a page and it had a scrollbar, the whole profile would move. thats what im after.


just put the whole profile in a movie clip lol
Hellcat

Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: May 9, 2007 8:34 PM
and all the actionscript, frames, buttons, rollovers, page changes etc will still work in 1 movieclip?
mike


M/23
Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: May 9, 2007 8:52 PM
Hellcat wrote:
and all the actionscript, frames, buttons, rollovers, page changes etc will still work in 1 movieclip?


depends on the actionscript :)

_root. paths will need changing..

but if you haven't got anything that says _root. as long as teh actions are inside teh movieclips chances are it will work..
Hellcat

Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: May 9, 2007 9:02 PM
oh kool. i will try it when i have finished everything else then. failing that i will have to make a button and do a frame by frame animation to scroll it in stages lol.
Copenhagen


M/20
Far Hills,
New Jersey
Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: Aug 19, 2007 1:31 PM
Ok so i changed this file around so that you can hold down the up and down buttons, re<myspace>size</myspace> the movie clip, and move it anywhere on the stage. YAY

YAY
Ryan


M/22
Denver,
Colorado
Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: Aug 19, 2007 4:44 PM
you need to upgrade buddy, we all have version of 8 or CS3 and it won't allow us to save for a version older then 8. Sorry but there is nothing that can really be done.
mike


M/23
Instant Message
Send Message
Reply with this quote Post a reply to this Topic Posted: Aug 19, 2007 9:46 PM
J A M E S wrote:
so the .fla files won't work in MX 2004 (and the most recent .fla posted by Copenhagen won't open in MX 2004). Will the action scripts posted throughout these tutorials work? Or are there differences there as well?


The files won't open but MX2004 uses AS2.0 which is the general AS posting in all tutorials.
Listing 1-15 of 18    1   2   of  2 Next >

dspPostReplies v29