class Block { var xx:Number, yy:Number; var type:Number; function Block(type:Number, xid:Number, yid:Number){ this.type = type; if(type == _root.TYPE_FRAME) init_frame(xid); else if(type == _root.TYPE_BLOCK) init_block(xid, yid); else init_x(xid, yid); } function init_frame(xid:Number){ xx = xid * (_root.wr + _root.wm) + _root.xm; yy = _root.ym; } function init_block(xid:Number, yid:Number){ xx = xid * (_root.wr + _root.wm) + _root.xm; yy = yid * (_root.hr + _root.hm) + _root.ym; } function init_x(xid:Number, yid:Number){// crossing block (horizontal line) xx = xid * (_root.wr + _root.wm) + _root.xm; yy = yid * (_root.hr + _root.hm) + _root.ym + _root.hr; } function draw(alpha:Number, col:Number){/* */ if(type == _root.TYPE_FRAME) draw_frame(alpha); else if(type == _root.TYPE_BLOCK) draw_block(alpha, col); else if(type == _root.TYPE_XR) draw_xr(alpha, col); else if(type == _root.TYPE_XL) draw_xl(alpha, col); else if(type == _root.TYPE_NX) draw_nx(alpha, col); } function draw_frame(alpha){// OK var c:Number = 0x666666; draw_sq2(c, alpha * 0.3, xx, xx + 1, yy, yy + (_root.hr + _root.hm) * _root.M + _root.hr); draw_sq2(c, alpha * 0.3, xx + _root.wr, xx + _root.wr + 1, yy, yy + (_root.hr + _root.hm) * _root.M + _root.hr); draw_sq2(c, alpha * 0.2, xx + _root.wr * 0.33, xx + _root.wr * 0.33 + 1, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + (_root.hr + _root.hm) * _root.M + _root.hr); draw_sq2(c, alpha * 0.2, xx + _root.wr * 1.33, xx + _root.wr * 1.33 + 1, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + (_root.hr + _root.hm) * _root.M + _root.hr); } function draw_block(alpha:Number, col:Number){ // front draw_sq2(col, alpha * 0.4, xx, xx + _root.wr, yy, yy + _root.hr); // top draw_sq3(col, alpha * 0.6, xx, xx + _root.wr * 0.33, xx + _root.wr * 1.33, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5); // side draw_sq3(col, alpha * 0.4, xx + _root.wr, xx + _root.wr * 1.33, xx + _root.wr * 1.33, yy, yy - _root.hr * 0.5, yy + _root.hr * 0.5); } function draw_xr(alpha:Number, c:Number){ // \ draw_sq3(c, alpha * 0.2, xx + _root.wr, xx + _root.wr * 1.33, xx + _root.wr * 2.33 + _root.wm, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + _root.hm); draw_sq3(c, alpha * 0.3, xx, xx + _root.wr * 0.33, xx + _root.wr * 1.33 + _root.wm, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + _root.hm); } function draw_xl(alpha:Number, c:Number){ // [ / ] left cross draw_sq3(c, alpha * 0.2, xx, xx + _root.wr * 0.33, xx - _root.wr * 0.67 - _root.wm, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + _root.hm); draw_sq3(c, alpha * 0.3, xx + _root.wr, xx + _root.wr * 1.33, xx + _root.wr * 0.33 - _root.wm, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + _root.hm); } function draw_nx(alpha:Number, c:Number){ // | draw_sq3(c, alpha * 0.2, xx, xx + _root.wr * 0.33, xx + _root.wr * 0.33, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + _root.hm); draw_sq3(c, alpha * 0.3, xx + _root.wr, xx + _root.wr * 1.33, xx + _root.wr * 1.33, yy, yy - _root.hr * 0.5, yy - _root.hr * 0.5 + _root.hm); } function draw_sq2(col, alpha, x0, x1, y0, y2){ draw_sq3(col, alpha, x0, x1, x1, y0, y0, y2); } function draw_sq3(col, alpha, x0, x1, x2, y0, y1, y2){ var x3 = x0 + x2 - x1; var y3 = y0 + y2 - y1; _root.beginFill(col, alpha); _root.moveTo(x0, y0); _root.lineTo(x1, y1); _root.lineTo(x2, y2); _root.lineTo(x3, y3); _root.endFill(); } }