I was not satisfied with the previous release of the scrollbar. It was too difficult to adapt and use, and it left very little space for upgrading.
So i made a new scrollbar class, with advanced features, with the precious help of Jack Kalish. Please stop by his site at www.kalicious.com, he was very helpful for this new version of the Scrollbar Class. Thanks Kali!
By the way. These are some of the new features.
- It is now possible to use every movieclip on the stage as the components of the scrollbar. You are not forced anymore to give your object defined instance names. They can be whatever you want.
- The class is now instantiated using the New Scrollbar constructor, that takes several parameters, leaves you more freedom and gives you the possibility to choose if you want the dragged movieclip to be blurred on dragging and the velocity of the movement.
- The class now releases errors on init() if you did not declare the right components and tells you what components are missing.
- The ruler (handler) length is now proportional to the length of the object dragged, as well as mousewheel velocity.
You do not need to instantiate the class by rightclick -> linkage, anymore.
The right way to use the class is now:
import Scrollbar;
var sc:Scrollbar = new Scrollbar(text, maskmc, scrollbar.ruler, scrollbar.background, area, true, 6);
sc.addEventListener(Event.ADDED, scInit);
addChild(sc);
function scInit(e:Event):void {
sc.init();
}
This is the example i made. As suggested by Kalish, i used a Input text to change runtime the length of the text box (to check for the change in the length of the scrollbar ruler)
And here you can download the class zip package, with an example inside.
Enjoy! And as usual, any comment is welcome!
Hi, i am writing this tutorial, to explain how to create a folder in your computer where to put all the libraries you can download from the web. This is called a class path, i.e. a folder where the flash IDE will search for class definitions. Flash has a default directory where it searches for standard Actionscript 3 classes. Now we are going to create and add a new folder to the Flash class path.
I create a folder on my desktop. I will call it Actionscript for convenience.
Whoa! The folder’s done. Now we have to make Flash IDE recognize it.
We open Flash, we go for Edit menu >> Preferences.
We select Actionscript in the left list and we access to the subpage where Actionscript preferences are set.
Now we have to click on the Actionscript 3.0 Settings… button.
This will open a new panel where we find:
- a dot
- $(AppConfig)/ActionScript 3.0/Classes
Now we click on the + sign to add an item to the list, that will be empty at first. We select it by clicking on it, and then we click the Browse to path button. We just have to browse to the Actionscript folder I created at the beginning, and then click Ok. The game is done.
Simply restart the flash IDE, and from this moment, every folder or file i will put into that directory, will be recognized by Flash.
I hope this is clear.
Let’s go for an example.
We download the Caurina Tweener Engine for AS3, from here.
We decompress the package to our desktop. In this case, everything inside this package must be copied to the Actionscript folder we created. In some cases, you will have to copy only particular folders. However, always follow instructions.
So copy the file in the folder. And you have your first library in your class path!
Enjoy!
Do you want to learn how to control your characters using the Keyboard? Learn how in this very simple tutorial, that build the basis of advanced game programming that will come in the next lessons!
Sit down, lesson is up, here!
Enjoy!