- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
function getActiveRoot():int
{
for(var c:int=0;c<i;c++) if(r_arr[c].isActive) return c;
return -1;
}
public function addEntry():void
{
if(getActiveRoot()<0)
{
r_arr.push(new Roots(i,in_txt.text,""));
r_arr[i].addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
r_arr[i].addEventListener(MouseEvent.MOUSE_UP, upHandler);
addChild(r_arr[i++]);
}
else
{
r_arr[getActiveRoot()].w_arr.push(new Words(getActiveRoot(),r_arr[getActiveRoot()].wi,in_txt.text,""));
r_arr[getActiveRoot()].w_arr[r_arr[getActiveRoot()].wi].addEventListener(MouseEvent.MOUSE_DOWN, WdownHandler);
r_arr[getActiveRoot()].w_arr[r_arr[getActiveRoot()].wi].addEventListener(MouseEvent.MOUSE_UP, WupHandler);
var ls:Shape=new Shape();
ls.graphics.lineStyle(1, 0xFF0000,0.2);
ls.graphics.moveTo(r_arr[getActiveRoot()].x,r_arr[getActiveRoot()].y);
ls.graphics.lineTo(r_arr[getActiveRoot()].w_arr[r_arr[getActiveRoot()].wi].x,r_arr[getActiveRoot()].w_arr[r_arr[getActiveRoot()].wi].y);
addChildAt(ls,++wd);
addChildAt(r_arr[getActiveRoot()].w_arr[r_arr[getActiveRoot()].wi++],++wd);
}
}
Ой. А давайте проц погоняем! Чтоб не скучал. Отовсюду будем запускать getActiveRoot() чтобы узнать индекс! Ха-ха-ха..