Advertisement
Guest User

TheList.as

a guest
Jun 4th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.     import flash.display.MovieClip;
  4.     import flash.display.Sprite;
  5.     import flash.events.MouseEvent;
  6.     import flash.geom.ColorTransform;
  7.     import flash.text.TextField;
  8.     import flash.events.Event;
  9.  
  10.  
  11.     public class TheList extends MovieClip
  12.     {
  13.  
  14.         private var _Container:ListContainer;
  15.         public var _ListItem:ListItem;
  16.         public var _Data:Array;
  17.         public var _Values:Array;
  18.         public var $CurrentValue:String;
  19.         public var _TextLabel:TextField;
  20.         public var Clickable:Boolean = true;
  21.        
  22.        
  23.                 public function TheList(Data:Array,Values:Array)
  24.         {
  25.             _Data = Data;
  26.             _Values = Values;
  27.  
  28.  
  29.  
  30.             initialize();
  31.         }
  32.  
  33.         private function initialize():void
  34.         {
  35.            
  36.             _TextLabel = new TextField();
  37.             addChild(_TextLabel);
  38.             _TextLabel.text = "Angle";
  39.             _Container = new ListContainer  ;
  40.             addChild(_Container);
  41.             _Container.x = 0;
  42.             _Container.y = 0;
  43.            
  44.        
  45.  
  46.             for (var i:int = 0; i < _Data.length; i++)
  47.             {
  48.                 _ListItem = new ListItem  ;
  49.                 _Container.addChild(_ListItem);
  50.  
  51.                 _ListItem.y = _ListItem.height * i;
  52.                 _ListItem.addEventListener(MouseEvent.MOUSE_DOWN,onItemDown,false,0,true);
  53.                 _ListItem.addEventListener(MouseEvent.MOUSE_UP,onItemUp,false,0,true);
  54.                 _ListItem.mouseChildren = false;
  55.                 _ListItem.value = _Values[i];
  56.                 _ListItem.name = _Data[i];
  57.                 _ListItem.ItemLabel.text = _ListItem.name;
  58.  
  59.  
  60.             }
  61.             addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
  62.             _Container.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false, 0, true);
  63.             addEventListener(MouseEvent.MOUSE_UP, onUp, false, 0, true);
  64.  
  65.  
  66.  
  67.         }
  68.  
  69.        
  70.         }
  71.  
  72.  
  73.         public function get Data():Array
  74.         {
  75.             return _Data;
  76.         }
  77.  
  78.         public function set Data(Value:Array):void
  79.         {
  80.             this._Data = Value;
  81.             initialize();
  82.         }
  83.        
  84.  
  85.  
  86.     }
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement