Guest User

Untitled

a guest
Aug 15th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. import flare.display.TextSprite;
  2. import flare.vis.data.NodeSprite;
  3.  
  4. import org.granite.math.IllegalArgumentError;
  5.  
  6. public class BlueNodeSprite extends NodeSprite {
  7. private var _node:Node;
  8. private var ts:TextSprite;
  9. /** used for layout priority*/
  10. protected var _zindex:int=0;
  11.  
  12. public function BlueNodeSprite(node:Node, name:String="") {
  13. super();
  14.  
  15. if (node == null || name == null)
  16. throw new IllegalArgumentError("can not be null");
  17.  
  18. _node=node;
  19. node.sprite=this;
  20.  
  21. ts=new TextSprite(name);
  22. this.addChild(ts);
  23.  
  24. //calc label position
  25. ts.x=-1 * ts.width / 2
  26. ts.y=-1 * ts.height / 2;
  27.  
  28. ts.mouseEnabled=false; //textsprite should not catch mouse events, so teamnodesprites can be dragged
  29.  
  30. this.size=2; //set default size
  31. this.buttonMode=true; // changes cursor to hand when mouseover
  32. }
  33.  
  34. public function get node():Node {
  35. return _node;
  36. }
  37.  
  38. public function set highlighted(h:Boolean):void {
  39. if (h) {
  40. //this.lineColor = 0xff990000;
  41. this.lineWidth=3;
  42. ts.bold=true;
  43. } else {
  44. //this.lineColor = 0xff000000;
  45. this.lineWidth=1;
  46. ts.bold=false;
  47. }
  48. }
  49.  
  50. public function get zindex():int {
  51. return _zindex;
  52. }
  53.  
  54. public function set zindex(zindex:int):void {
  55. this._zindex=zindex;
  56. }
  57. }
Add Comment
Please, Sign In to add comment