Actionscript 3 Scrollbar
I am very new to ActionScript and Flash deve开发者_开发技巧lopment so excuse any incorrect terminology that I may use. I'm just playing around in some spare time.
I'm developing on Ubuntu, using AS3, and compiling with the flex sdk using the ANT tasks (flexTasks-4.0.0.10485).
I am looking for a way to scroll content within a sprite. So, say I have a sprite that is 100px in height, and I add several child objects stacked on top of each other that exceed the sprite height, then I would like to display a scrollbar to enable scrolling through the children.
Now I found fl.controls.ScrollBar, but when I attempt to import the class I receive the error:
Error: Definition fl.controls:ScrollBar could not be found
I'm not sure why I am receiving this error, as this appears to be a valid AS 3 component according to the livedocs.
Is there something I am missing? Is there a scrollbar component in AS 3 that can be attached to a display container like a sprite?
Thanks
In order to use the component you need to have it in the library. One way of adding it is:
Get Adobe Flash Professional and install it;(Wine may run (enough to get you going) CS3 by now)
Drag the ScrollBar component(from the components panel in your library)
Set Flash to generate a swc file (see File->Publish Settings->Flash);
Add this swc file to your library ( check flexTasks documentation on how to do this,basically you need to provide the path to it when doing the compile with FlexSDK );
In my opinion you're better off with a scroll class someone else created.
There is a tutorial here http://www.goflash.org/blog/tutorial-scrollbar-flash-as3/
The page is in Romanian but I'm sure you'll figure it out as the source code is posted (Download Source)
Hope it helps! Have fun!
精彩评论