A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Horizontal Scroll in List Component?

  1. #1
    Senior Member
    Join Date
    Nov 2007
    Posts
    207

    Horizontal Scroll in List Component?

    Is there an option to turn on the horizontal scroll for the list component? I have some list entries that are longer than the list is wide, so they get cut off at the end...can this be done?

  2. #2
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    Solution:

    code:

    my_list.hScrollPolicy = "on";



    ...I should have googled!

  3. #3
    Senior Member
    Join Date
    Nov 2007
    Posts
    207
    it was brought to my attention that I was misssing a key element to get that function to work...

    code:

    theList.maxHPosition = 100;



    I took it one step further...I put in a condition which checks the lengths of the list elements, and the width is only as wide as the longest entry...

    Im actually populating my list from an XML so the code is geared toward that...

    code:

    var listWidth:Number;

    ExList.onLoad = function()
    {
    var nodes = this.firstChild.childNodes;
    numOfItems = nodes.length;
    listWidth = nodes[0].attributes.ex_name.length;//here we assign the first array element as the highest width to start...
    for(var i=0; i<numOfItems; i++)
    {
    .
    .
    .
    exList.addItem({label:_global.exName[i], data:_global.boothID[i]});//list item added
    if(nodes[i].attributes.ex_name.length > listWidth)//checks to see if current list item is longer than the max up to this point
    {
    listWidth = nodes[i].attributes.ex_name.length;//if the current item is higher than the previous max, make the current item the max
    }
    }
    exList.hScrollPolicy = "on";//turn on the horizontal scroll bar
    exList.maxHPosition = listWidth;//set the width of the list element(max horizontal scroll) to the widest element in the list
    }
    ExList.load("blah.xml");



    eh??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center