package Chart
{
import flash.display.DisplayObjectContainer
import Chart.Draw;
import flash.display.*;
import flash.filters.*
import flash.text.TextFieldAutoSize;
import flash.text.TextField;
import flash.events.Event;
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.events.MouseEvent;
import flash.geom.Transform;
import flash.geom.Matrix;
public class CurrentFigures extends Sprite{
private var currentFigures:Array = new Array(); //Array with the updated index of the elements in arrayDraw
private var instructions:TextField = new TextField(); //Instructions about the multiples and divisors
private var selectedNumber:TextField = new TextField(); //Textfield with the text The selected number is
private var fieldName:TextField = new TextField(); //Textfield with the number selected
private var overNumber:TextField = new TextField(); //Textfield with the number of the caracter under mouse
private var overNumberLabel:TextField = new TextField(); //Textfield with the label of the number of the caracter under mouse
private var todosDibujos:Array = new Array; //Array with all the draw objects contained in the XML File (arrayPersons)
private var arrayDraw:Array = new Array; //Array containing the draw Object (arrayDraw.object) and the quality of the relation (arrayDraw.relation)
private var arrayRelations:Array = new Array; //Contains relations among persons: fromID, toID, quality
private var subRelation:Array = new Array;
private var container:Sprite = new Sprite();
private var originX:uint = 400;
private var originY:uint = 365;
private var nuevoContainer:Sprite=new Sprite();
private var affineTransform:Matrix;
private var distanceBetweenCircle:uint = 70;
static private const ancho:Number = 1000;
static private const alto:Number = 800;
private function setDisplayInfo():void {
// container.width=800;
// container.height=800;
/* fieldName.height=50;
fieldName.width=300;
fieldName.x=850;
fieldName.y=125;
fieldName.autoSize=TextFieldAutoSize.LEFT;
overNumber.height=50;
overNumber.width=300;
overNumber.x = 850;
overNumber.y = 150;
overNumber.autoSize=TextFieldAutoSize.LEFT;
overNumberLabel.height=50;
overNumberLabel.width=300;
overNumberLabel.x = 700;
overNumberLabel.y = 150;
overNumberLabel.autoSize=TextFieldAutoSize.LEFT;
overNumberLabel.htmlText = " You are on the number: ";
selectedNumber.height=50;
selectedNumber.width=150;
selectedNumber.x=700;
selectedNumber.y=125;
selectedNumber.autoSize=TextFieldAutoSize.LEFT;
selectedNumber.htmlText="You have selected number: ";
instructions.border=true;
instructions.height=50;
instructions.width=200;
instructions.x=700;
instructions.y=100;
instructions.autoSize=TextFieldAutoSize.LEFT;
instructions.htmlText = "Click one number to show all its multiples and divisors";
container.addChild(overNumber);
container.addChild(overNumberLabel);
container.addChild(fieldName);
container.addChild(selectedNumber);
container.addChild(instructions);
nuevoContainer.addChild(container);*/
}
public function CurrentFigures (arrayPersons:Array, arrayRelations:Array):void {
setDisplayInfo(); //Set the display (name, number...)
this.arrayRelations = arrayRelations;
for (var j:int=0; j 0 ) {
scaleAt(6/5, origenX, origenY );
} else {
scaleAt(5/6, origenX, origenY );
}
}
}
private function drawFigures():void {
var iguales:Boolean = false;
var angle:Number = 0;
var draW:Draw;
arrayDraw[0].setXWanted(originX);
arrayDraw[0].setYWanted(originY);
var veamos:int = 1;
var valor:Number = 0
for (veamos; (valor + 12 + Math.pow(3, veamos)) < arrayDraw.length; veamos++) {
valor += 12 + Math.pow(3, veamos)
}
var vueltaActual:int = 1;
for (var i:int = 1; i(valorX + 12 + Math.pow(3, vueltaActual)) || (i-1)==(valorX + 12 + Math.pow(3, vueltaActual)); vueltaActual++) {
valorX += 12 + Math.pow(3, vueltaActual)
}
var numeroADividir:int;
if ((i-1) < valor) {
numeroADividir = 12 + Math.pow(3, vueltaActual);
angle += (360/(numeroADividir))*Math.PI/180;
} else {
angle += 360/(arrayDraw.length-valor-1)*Math.PI/180;
}
arrayDraw[i].setXWanted(originX + (((100 - (arrayDraw[i].getQuality()*15) + (vueltaActual * distanceBetweenCircle))*Math.cos(angle)))); //Final destination of the figure
arrayDraw[i].setYWanted(originY + (((100 - (arrayDraw[i].getQuality()*15) + (vueltaActual * distanceBetweenCircle))*Math.sin(angle))));
}
}
public function click(draw:Draw): void {
var tempArray:Array = new Array();
var drawClicked:Draw;
drawClicked=draw;
drawClicked.setQuality(0);
for (var i:int = 0; i