Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flare.display.TextSprite;
- import flare.vis.data.NodeSprite;
- import org.granite.math.IllegalArgumentError;
- public class BlueNodeSprite extends NodeSprite {
- private var _node:Node;
- private var ts:TextSprite;
- /** used for layout priority*/
- protected var _zindex:int=0;
- public function BlueNodeSprite(node:Node, name:String="") {
- super();
- if (node == null || name == null)
- throw new IllegalArgumentError("can not be null");
- _node=node;
- node.sprite=this;
- ts=new TextSprite(name);
- this.addChild(ts);
- //calc label position
- ts.x=-1 * ts.width / 2
- ts.y=-1 * ts.height / 2;
- ts.mouseEnabled=false; //textsprite should not catch mouse events, so teamnodesprites can be dragged
- this.size=2; //set default size
- this.buttonMode=true; // changes cursor to hand when mouseover
- }
- public function get node():Node {
- return _node;
- }
- public function set highlighted(h:Boolean):void {
- if (h) {
- //this.lineColor = 0xff990000;
- this.lineWidth=3;
- ts.bold=true;
- } else {
- //this.lineColor = 0xff000000;
- this.lineWidth=1;
- ts.bold=false;
- }
- }
- public function get zindex():int {
- return _zindex;
- }
- public function set zindex(zindex:int):void {
- this._zindex=zindex;
- }
- }
Add Comment
Please, Sign In to add comment