0
votes

I'm looking for the best way to display relatively simple mathematical formulas in ActionScript. So far the best solution that I found is the "MathML Parser written in ActionScript 3": http://www.sevenson.com.au/actionscript/mathml/ The author generously published the source code, and it's a good start, but it needs more work.

I also found http://www.fmath.info/ , but I don't see how it can be used with pure ActionScript (I'm not using Flex).

My question is: can you recommend a good AS3 library that would render MathML or a similar formula language as a Sprite?

1
"Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." What topics can I ask about here? - Anil Natha
Problem: Display mathematical formulas in ActionScript. What has been done: Tried sevenson.com.au/actionscript/mathml and fmath.info . Both are not complete solutions to the above problem. - user1566515

1 Answers

1
votes

This is the best one I've seen: http://sharemath.com/

It covers a wide range of mathematical inputs. Most of it adjustable from XML I think as well. It's worth looking into even if you just want to get a base of what it might look to make it from scratch.

There is also something known as LaTeX that we use often: http://validi.fi/latex2flash/

Either way speaking from experience, it is a very tricky process doing this from scratch so having something to at least base it off of is a extremely useful.

LaTeX integration example taken from the link provided above:

package
{
  import flash.display.*;
  import flash.text.*;
  import flash.events.KeyboardEvent;

  public class Test extends MovieClip
  {
    private var latexField : LatexField;
    private var inputField : TextField;

    public function Test()
    {
      inputField = new TextField();
      inputField.type = TextFieldType.INPUT;
      inputField.border = true;
      latexField = new LatexField();
      latexField.eqString = "\\sum_{i=0}^ni=1+2+3+4+\\ldots +n";
      latexField.x = 200;
      addChild(inputField);
      addChild(latexField);
      inputField.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
    }

    private function keyUpListener(e:KeyboardEvent):void
    {
      //ENTER
      if (e.keyCode == 13) {
        latexField.eqString = escape(TextField(e.target).text);
      }
    }
  }
}

Good luck!