Reder instead of get value
In the previous session, we discussed about the parsing of an equation string. We filt out the operator and left/ right substring and if the operator is "+", we add number1 and number2 derived from left/right substring.
To make an equation grapher, the logic is the same. When we have an operator "+" and left/right substring, we create textfiled and arrange them in proper position.
The job is achieved through recursive call of the same function, and the arrangement is performed from child to parent.
While previous movie is done through one function, here I stripped off the get value part and isolate the parser into a single class - the EquationObject class. Then I create an EquationDisplayer to display the result of the parser..
So, the souce includes several class file and the source fla is Flash MX 2004 format.
The structure is a bit cleaner than the MX one.
Bug about pow
Scott helped me to fix the bug here.
For an equation with Math.pow function, I put the second parameters as subscript. For example, "pow(x,2)" or pow(5,2), we can display them as x2 and 52,
But for an equation "pow(5+x,2)", we need to add a parenthesis. The correct display should be (5+x)2 not just 5+x2;
download source fla