Skip to content

Commit

Permalink
Correções nas telas de orientações e créditos, alteração no posiciona…
Browse files Browse the repository at this point in the history
…mento dos objetos, inserção do tutorial, ajustes no gráfico.
  • Loading branch information
alexandrefornari committed Mar 9, 2012
1 parent d49bf62 commit b27b57a
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 42 deletions.
Binary file modified src/AI-0086.fla
Binary file not shown.
142 changes: 101 additions & 41 deletions src/Main.as
Expand Up @@ -46,7 +46,7 @@
private var equation:Array = new Array(numEquations);
private var labelEq:Array = new Array(numEquations);
private var labelText:Array = new Array();
private var offset:Number = 20;
private var offset:Number = 10;
private var aLabel:Label = new Label();// Certo ou Errado
//
//RadioButton Vars
Expand All @@ -70,8 +70,8 @@
private var Graph:SimpleGraph;
private var xRange:Array = [-5, 5];
private var yRange:Array = [-5, 5];
private var GRAPH_WIDTH = 400;
private var GRAPH_HEIGHT = 360;
private var GRAPH_WIDTH = 420;
private var GRAPH_HEIGHT = 380;

//SCORM VARIABLES
private var completed:Boolean;
Expand Down Expand Up @@ -196,7 +196,7 @@
btCheck.y = 230;

btNew = new BotaoReiniciar();
btNew.x = btCheck.x + btCheck.width + 10;
btNew.x = btCheck.x + btCheck.width / 2 + 15 + btNew.width / 2;
btNew.y = 230;

addChild(btCheck);
Expand All @@ -205,9 +205,17 @@
geraEq();
corrEq();

pontaY.x = Graph.x + GRAPH_WIDTH / 2 + 0.5;
pontaY.y = Graph.y;

pontaX.x = Graph.x + GRAPH_WIDTH;
pontaX.y = Graph.y + GRAPH_HEIGHT / 2 + 0.5;

addListeners();

initLMSConnection();

iniciaTutorial();
}

private function addListeners():void
Expand Down Expand Up @@ -244,16 +252,16 @@
var resetTT:ToolTip = new ToolTip(botoes.resetButton, "Reiniciar", 12, 0.8, 100, 0.6, 0.1);
var intTT:ToolTip = new ToolTip(botoes.tutorialBtn, "Reiniciar tutorial", 12, 0.8, 150, 0.6, 0.1);

var finalizaTT:ToolTip = new ToolTip(btCheck, "Finaliza atividade", 12, 0.8, 200, 0.6, 0.1);
var newTT:ToolTip = new ToolTip(btNew, "Reiniciar", 12, 0.8, 250, 0.6, 0.1);
//var finalizaTT:ToolTip = new ToolTip(btCheck, "Finaliza atividade", 12, 0.8, 200, 0.6, 0.1);
//var newTT:ToolTip = new ToolTip(btNew, "Reiniciar", 12, 0.8, 250, 0.6, 0.1);

addChild(infoTT);
addChild(instTT);
addChild(resetTT);
addChild(intTT);

addChild(finalizaTT);
addChild(newTT);
//addChild(finalizaTT);
//addChild(newTT);
}

private function btChecka(event:MouseEvent):void {
Expand Down Expand Up @@ -337,6 +345,8 @@
}
geraEq();
corrEq();
setChildIndex(balao, numChildren - 1);
setChildIndex(bordaAtividade, numChildren - 1);
}
//f(x) = a + b * ln[c * (x-d)]
//Função que gera equações
Expand All @@ -351,8 +361,8 @@
if (!comparaEq()) {
for (var j:uint = 1; j <= numEquations; j++) {
labelEq[j] = new RadioButton();
labelEq[j].x = 460;
labelEq[j].y = offset + 30*j;
labelEq[j].x = 450;
labelEq[j].y = 25 + 30*j;
labelEq[j].label = "";
labelEq[j].value = "y = "+ String(equation[j]).replace("*","");
labelEq[j].name = j;
Expand All @@ -361,8 +371,8 @@
labelEq[j].setStyle("textFormat", newFormat);
addChild(labelEq[j]);
labelText[j] = new TextField();
labelText[j].x = 30 + 460;
labelText[j].y = offset + 30*j;
labelText[j].x = 30 + 450;
labelText[j].y = 25 + 30*j;
labelText[j].text = "y = "+ String(equation[j]).replace("*","").replace("- -","+ ");
labelText[j].setTextFormat(newFormat);
labelText[j].autoSize = "left";
Expand Down Expand Up @@ -408,17 +418,27 @@
randomTrue = rand(1,numEquations);
equation[randomTrue] = randomA[randomTrue] + "+" + randomB[randomTrue] + "*ln(" + randomC[randomTrue] + "*(x-" + randomD[randomTrue] + "))";
// Gráfico
if (Graph != null) removeChild(Graph);

Graph = new SimpleGraph(GRAPH_WIDTH, GRAPH_HEIGHT);

Graph.x = offset;
Graph.y = offset;
Graph.board.setVarsRanges(xRange[0], xRange[1], yRange[0], yRange[1]);
Graph.board.drawAxes();
Graph.board.changeBorderColorAndThick(0xFFFFFF, 0);
Graph.board.changeBackAlpha(0);
//Graph.board.setCrossSizeAndThick(10, 10);
//Graph.board.setTicks(2, 2, 10, 10);
Graph.board.drawTicks();
Graph.board.drawGrid();
//Graph.board.drawGrid();
Graph.board.addLabels();
Graph.board.disableCoordsDisp();
Graph.graphRectangular(equation[randomTrue], "x", 1, 2, 0xCC0000);
addChild(Graph);

setChildIndex(pontaX, numChildren - 1);
setChildIndex(pontaY, numChildren - 1);
}

//Função que limpa alternativas
Expand Down Expand Up @@ -446,60 +466,100 @@
}


//------------------------- Tutorial -----------------------------//


//Tutorial
private var balao:CaixaTexto;
private var pointsTuto:Array;
private var pointsTuto2:Array;
private var tutoBaloonPos:Array;
private var tutoBaloonPos2:Array;
private var tutoPos:int;
private var tutoSequence:Array = ["Estas placas de Petri contém três espécies distintas de bactérias.",
"Classifique as bactérias arrastando os rótulos para as placas de Petri.",
"O tubo de ensaio contém um líquido propício à proliferação das três bactérias.",
"Esta escala indica a distribuição de oxigênio no tubo de ensaio: quanto mais verde, mais oxigênio há naquela altura do tubo.",
"Você pode arrastar uma ou mais bactérias para dentro do tubo de ensaio.",
"Pressione este botão para trocar o tubo de ensaio e começar uma nova experiência."];
private var tutoPhaseFinal:Boolean;
private var tutoSequence:Array = ["Este é o gráfico de uma função logarítmica, escolhida aleatoriamente.",
"Uma dessas alternativas contém a expressão da função cujo gráfico aparece ao lado. Identifique-a e, em seguida, pressione \"terminei\"."];

private var tutoSequence2:Array = ["A resposta correta foi destacada em verde.",
"Você pode começar um novo exercício pressionando o botão \"Novo exercício\"."];

private var ptAltCerto:Point = new Point();

private function iniciaTutorial(e:MouseEvent = null):void
{
tutoPos = 0;
tutoPhaseFinal = false;
if(balao == null){
balao = new CaixaTexto(true);
addChild(balao);
balao.visible = false;

pointsTuto = [new Point(),
new Point(),
new Point(),
new Point(),
new Point(),
new Point()];
pointsTuto = [new Point(Graph.x + GRAPH_WIDTH / 2, Graph.y + GRAPH_HEIGHT / 2),
new Point(455, 127)];

tutoBaloonPos = [[CaixaTexto.TOP, CaixaTexto.CENTER],
[CaixaTexto.RIGHT, CaixaTexto.CENTER]];

tutoBaloonPos = [[CaixaTexto.BOTTON, CaixaTexto.CENTER],
[CaixaTexto.TOP, CaixaTexto.CENTER],
[CaixaTexto.LEFT, CaixaTexto.FIRST],
[CaixaTexto.LEFT, CaixaTexto.CENTER],
[CaixaTexto.BOTTON, CaixaTexto.CENTER],
[CaixaTexto.LEFT, CaixaTexto.LAST]];
pointsTuto2 = [ptAltCerto,
new Point(btNew.x, btNew.y - btNew.height / 2)];

tutoBaloonPos2 = [[CaixaTexto.RIGHT, CaixaTexto.CENTER],
[CaixaTexto.BOTTON, CaixaTexto.LAST]];
}
balao.removeEventListener(Event.CLOSE, closeBalao);
btCheck.removeEventListener(MouseEvent.CLICK, iniciaTutorialSegundaFase);

balao.setText(tutoSequence[tutoPos], tutoBaloonPos[tutoPos][0], tutoBaloonPos[tutoPos][1]);
balao.setPosition(pointsTuto[tutoPos].x, pointsTuto[tutoPos].y);
balao.addEventListener(Event.CLOSE, closeBalao);
balao.visible = true;
setChildIndex(balao, numChildren - 1);
setChildIndex(bordaAtividade, numChildren - 1);
}

private function closeBalao(e:Event):void
{
tutoPos++;
if (tutoPos >= tutoSequence.length) {
ptAltCerto.x = labelEq[randomTrue].x;
ptAltCerto.y = labelEq[randomTrue].y + labelEq[randomTrue].height / 2;

if (tutoPhaseFinal) {
tutoPos++;
if (tutoPos >= tutoSequence2.length) {
balao.removeEventListener(Event.CLOSE, closeBalao);
balao.visible = false;
btCheck.removeEventListener(MouseEvent.CLICK, iniciaTutorialSegundaFase);
tutoPhaseFinal = false;
}else {
btCheck.removeEventListener(MouseEvent.CLICK, iniciaTutorialSegundaFase);
balao.setText(tutoSequence2[tutoPos], tutoBaloonPos2[tutoPos][0], tutoBaloonPos2[tutoPos][1]);
balao.setPosition(pointsTuto2[tutoPos].x, pointsTuto2[tutoPos].y);
setChildIndex(balao, numChildren - 1);
setChildIndex(bordaAtividade, numChildren - 1);
}
}else{
tutoPos++;
if (tutoPos >= tutoSequence.length) {
balao.removeEventListener(Event.CLOSE, closeBalao);
balao.visible = false;
btCheck.addEventListener(MouseEvent.CLICK, iniciaTutorialSegundaFase);
tutoPhaseFinal = true;
}else {
balao.setText(tutoSequence[tutoPos], tutoBaloonPos[tutoPos][0], tutoBaloonPos[tutoPos][1]);
balao.setPosition(pointsTuto[tutoPos].x, pointsTuto[tutoPos].y);
setChildIndex(balao, numChildren - 1);
setChildIndex(bordaAtividade, numChildren - 1);
}
}
}

private function iniciaTutorialSegundaFase(e:MouseEvent):void
{
if (respUser == "") return;
if (tutoPhaseFinal) {
balao.removeEventListener(Event.CLOSE, closeBalao);
balao.visible = false;
//tutoPhase = false;
}else {
balao.setText(tutoSequence[tutoPos], tutoBaloonPos[tutoPos][0], tutoBaloonPos[tutoPos][1]);
balao.setPosition(pointsTuto[tutoPos].x, pointsTuto[tutoPos].y);
tutoPos = 0;
balao.setText(tutoSequence2[tutoPos], tutoBaloonPos2[tutoPos][0], tutoBaloonPos2[tutoPos][1]);
balao.setPosition(pointsTuto2[tutoPos].x, pointsTuto2[tutoPos].y);
balao.addEventListener(Event.CLOSE, closeBalao);
setChildIndex(balao, numChildren - 1);
setChildIndex(bordaAtividade, numChildren - 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/flashandmath/as3/boards/GraphingBoard.as
Expand Up @@ -154,7 +154,7 @@ package flashandmath.as3.boards {
this.addChild(spMask);

shBorder=new Shape();
this.addChild(shBorder);
//this.addChild(shBorder);

spBoard.mask=spMask;

Expand Down

0 comments on commit b27b57a

Please sign in to comment.