AS3 Scrollbar: Scrollbase Class [Updated]
May 18th, 2009
Hi again, i update my scrollbar AS3 Class, named scrollbase, and today i post it for download, it’s really ease to work and so smaller than past version, only 1.5 kb.
The Features:
• Small file size
• Ease effect (or not) when move content
• Click the scroll background to move
• Full customizable
• Scroll dragger with dynamic size
• All in one line
To use it you can write only two lines, so easy. The first line is the import and the second line is the scrollbase constructor, you need only put inside the constructor basicaly four movieclips, like show the sequence: content movieclip, mask of the content movieclip, the dragger movieclip and last movieclip is the background of the dragger, where the dragger will slide. Show the sample code bellow:
import com.dLibs.utils.scrollbase; var sb:scrollbase = new scrollbase(conteudo,mascara,dragger,background,5,30);
This code show that ‘conteudo’ is the content movieclip and will be mask for ‘mascara’. ‘dragger’ is the movieclip that you click and move to see the rest of the content and move this movieclip upper of ’background’ movieclip. So easy, but there we have some more arguments.
The fiveth argument is the Ease speed, you can change for more or less ease effect, by default the ease uint is 1 (one). The sixth argument is the bottom padding, you can put a number in pixels to show after the content movieclip, so much good for full background scrollbar, by default this padding is 0 (zero).
When you need you can verify if the scrollbase is necessary using the public function verifyHeight(). You can change the content of the moviclip and verify if content movieclip have the height propertie bigger than your mask. Usage:
import com.dLibs.utils.scrollbase; var sb:scrollbase = new scrollbase(conteudo,mascara,dragger,background,5,30); sb.verifyHeight();
You can download and change if you need. Try it!
Download the Scrollbase sample and independent class (1487)
Scrollbase by Scrollbar for AS3 is licensed under a Creative Commons Attribution 3.0 United States License.
Based on a work at code.google.com.
26 July ‘09 /EDIT —————————–
I’m working in a new version of scrollbase and as soon as possible i will post here the classe code and samples, now im working with a temp class named scrollbasic that i made to resolve the problem that @sonia said in comment. You can download the scrollbasic with link bellow and as so simple to use like scrollbase:
import com.dLibs.utils.scrollbasic;
var nsc:scrollbasic = new scrollbasic(DataRecord.getDocumentClass, conteudo, mascara, sdragger, sbground);
Need set the main document class, you can create one static class to set and get it, and set the movieclips as content clip, mask clip, dragger clip and scrollbar background. Probabily i will post the new version of scrollbase 31 July ‘09.
Thanks for all and sorry for the error.
: )





May 18th, 2009 at 17:47
Ok man, great job!
I have made a scroll class too. Verify in http://blog.ramonfritsch.com/t/scroll
cheers
May 19th, 2009 at 08:56
[...] March 3rd, 2009 UPDATE: Scrollbar AS3: Scrollbase Class [Updated] [...]
May 25th, 2009 at 21:52
Opá, tudo certo?
Que bom que gostou.. coloquei teu rss no meu reader
o que acha de trocarmos links?
grande abraço
May 26th, 2009 at 03:34
Очень полезная вещь, спасибо!!
May 26th, 2009 at 15:30
@Ramon Fritsch: pode entrar em contato pelo p[at]novesfora[dot]com[dot]br
May 29th, 2009 at 00:05
Dale!
Te mandei e-mail lá.. abração!
May 30th, 2009 at 18:28
Мне кажется очень полезная штука
June 1st, 2009 at 12:50
Olá, em primeiro lugar obrigado pela classe!
Entretanto tenho andado a tentar usar isto no meu projecto mas existem coisas que não funcionam por provavelmente estar a importar o swf com a scrool para um parent.
o Erro que aparece é o seguinte:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at dLibs.utils::scrollbase()
at vivamelhor_fla::MainTimeline/frame1()
Penso que tem a ver com os EventListener para as funcoes releaseDrag e moveContentWheel, visto que nenhuma delas funciona.
Tentei usar “parent” mas nao deu…
Obrigado!
June 1st, 2009 at 17:43
David, testei o scroll importando para outro SWF file e funciona normal, vou fazer outros testes e posto alguma novidade aqui. Breve.
June 2nd, 2009 at 06:22
Obrigado Pablo,
Eu no swf principal tenho este codigo:
function vivaMelhor(event:MouseEvent):void{
var vm:swfContainer=new swfContainer(756,1359,”vivamelhor.swf”,”loader.swf”);
removeChild(objecto);
addChild(vm);
vm.x = 317;
vm.y = 348;
objecto=vm;
}
A funcção acima basicamente é uma classe que chama um swf e coloca na MainTimeline.
Depois tenho o código que está neste vivamelhor.swf
var sb:scrollbase = new scrollbase(texto_mc,mascara,dragger,background,5);
Que funciona perfeitamente quando o exporto sozinho, mas quando o chamo pelo swf principal, da-me o erro que te indiquei.
Obrigado mais uma vez
June 4th, 2009 at 20:40
@David: Acredito que encontrei o problema do scroll, estou fazendo alguns testes hoje e amanha e logo farei uma atualização e deixarei aqui o aviso. Obrigado.
June 12th, 2009 at 14:13
Seu trabalho é excepcional , vamos trocar umas idéias um dia desses, mesmo nome, programando as3 e morando em Goiânia… que estranho, não pode ser coincidência.
June 14th, 2009 at 19:10
@Pablo Erick Cardoso, obrigado pelo excepcional mesmo eu nao acreditando tanto nisso eheheh. Vamos trocar ideia sim é essa a ideia basica de eu ter criado o blog e todos os meios de redes sociais ate hoje ehehe. Sou Pablo também e ainda de Goiânia assim como voce. Qualquer coisa me add no Twitter: @pablodavi ou se preferir me adicione no MSN: p@novesfora.com.br
June 16th, 2009 at 23:59
muito bom..
cara, postei uma classe para scroll tb..
se quizer dar uma olhada:
http://www.blog.diogolean.com/
July 23rd, 2009 at 07:38
hello,
i use this scrollbar class;
it works very well under windows but against the scrollbar does not work on Mac (wheel mouse).
Do you know why?
Thanl you !!!
July 23rd, 2009 at 10:53
@sonia im working on other version of scrollbase and will be mac wheel fixed. Sorry.
July 23rd, 2009 at 11:06
@pablo Ok, thank you!
But just out of curiosity, why does this not work on Mac?
July 23rd, 2009 at 18:27
@sonia the wheel feature need to be simulated by javascript to work on mac. See: http://hasseg.org/blog/?p=138
cheers
July 26th, 2009 at 13:07
Hello,
When I delete a clip that contains the scrollbar, I have always this error:
TypeError: Error # 1009: It is impossible to access the property or method of a null object reference.
At com.dLibs.utils: scrollbase /:: releaseDrag ()
how to remove the scrollbar when deleting a clip so that we no longer have this error?
Thank you:)
July 26th, 2009 at 17:55
Hi @sonia. i updated the post with a temporary scrollbar class and i promisse that i will post the new version with no bugs 31 July. Sorry for all and thanks for your comments and feedback
: )
July 26th, 2009 at 18:16
Okay thank you !!!
November 27th, 2009 at 19:53
..]one useful source of information on this subjectis ,blog.des84.com,..]
February 3rd, 2010 at 19:07
You did a good job at explaining this one, thank you for sharing.
May 19th, 2010 at 11:03
This is my second visit to your blog. We are starting a brand new initiative in the same niche as this blog. Your blog provided us with valuable information to work on. You have done a marvellous job.