Flex Mobile SectionList


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package org.corlan.components {
  2.  
  3. import flash.events.MouseEvent;
  4. import spark.components.IItemRenderer;
  5. import spark.components.List;
  6.  
  7. public class SectionList extends List {
  8.  
  9. /**
  10. * The property name for data that are section title items
  11. */
  12. private var _sectionField:String;
  13.  
  14. public function set sectionField(value:String):void {
  15. _sectionField = value;
  16. }
  17.  
  18. /**
  19. * Disable selection for section title items
  20. */
  21. override protected function item_mouseDownHandler(event:MouseEvent):void {
  22. var data:Object;
  23. if (event.currentTarget is IItemRenderer)
  24. data = IItemRenderer(event.currentTarget).data;
  25. if (data && data[_sectionField])
  26. event.preventDefault();
  27. super.item_mouseDownHandler(event);
  28. }
  29.  
  30. }
  31. }

URL: http://corlan.org/?p=2931

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.