-
Custom scrollers for the TileList
Anyone know how, or seen a tutorial on how to control the scroll bar position of the TileList component? I'd like to turn them off, and use the mouse position left or right of center to scroll it in one direction or the other. I've seen similar things with out the component for AS2, but that just willn't do.
Thanks.
-
the following might help it dose not use a data grid but is similar to what you are lookin for:
http://www.flepstudio.org/forum/flep....html#post6589
Last edited by arsenik; 12-26-2007 at 08:02 AM.
-
ok , you have to change the scrolling part of the following code, it is not that much friendly , did not spend much time on it.
PHP Code:
import fl.controls.DataGrid;
import fl.controls.ScrollPolicy;
import fl.data.DataProvider;
import fl.events.DataGridEvent;
import fl.events.ListEvent;
var i:uint;
var totalRows:uint = 50;
var dp:DataProvider = new DataProvider();
for (i = 0; i < totalRows; i++) {
dp.addItem({Title:getRandomNumber(), col2:getRandomNumber(), col3:getRandomNumber(), col4:getRandomNumber()});
}
var myGrid:DataGrid = new DataGrid();
myGrid.setSize(500, 300);
myGrid.columns = ["Title", "col2", "col3"];
myGrid.dataProvider = dp;
addChild(myGrid);
myGrid.verticalScrollPolicy=ScrollPolicy.OFF
myGrid.addEventListener(MouseEvent.MOUSE_MOVE,_move);
function getRandomNumber():uint {
return Math.round(Math.random() * 100);
}
var j:int=0
function _move(event:MouseEvent):void{
if(event.stageY<myGrid.y+(myGrid.height/2)&&j>0&&j<=totalRows)myGrid.scrollToIndex (j-=1)
if(event.stageY>myGrid.y+(myGrid.height/2)&&j<totalRows&&j>=0)myGrid.scrollToIndex (j+=1)
}
-
Thanks, I'll see if I can tweak this for the TileList component.
-
Hm.. using the scroll to index doesn't get a nice scrolling effect. I'm loading images up in the tileList. If you don't see the images change, you don't realize it ever scrolled for the lack of horizontal motion in my case.
-
simply use a mask over your titlelist and change the .x .y properties of the title list, you can use ready to use , plugnplay classes like tweener or tweenlite to get a better motion, I am not gonna provide you with code this time cause you are getting used to the fish, go fish for yourself ha ha ha ha just joking, try the above and see if it helps.
-
-
That's a good idea. Why am I stuck thinking I should move the content of the thing when I can just move the thing its self, under a mask of coarse. My brain defaults to the obvious. I forget this is flash.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|